From 679b0465e4937f42ec5e6aaca0636f3baf97ba12 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@git-test.afi-sa.fr>
Date: Thu, 7 Jun 2012 15:35:13 +0000
Subject: [PATCH] =?UTF-8?q?OPDS:=20=20re=CC=81utilise=20=20la=20cate=CC=81?=
 =?UTF-8?q?gorie=20d'import=20du=20jour=20si=20existe=20de=CC=81ja=CC=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 library/Class/WebService/OPDS/CatalogEntry.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/library/Class/WebService/OPDS/CatalogEntry.php b/library/Class/WebService/OPDS/CatalogEntry.php
index cc59fd3328a..e102b50e73f 100644
--- a/library/Class/WebService/OPDS/CatalogEntry.php
+++ b/library/Class/WebService/OPDS/CatalogEntry.php
@@ -54,8 +54,10 @@ class Class_WebService_OPDS_CatalogEntry {
 
 
 	public function import() {
-		$category = Class_AlbumCategorie::getLoader()->newInstance()
-			->setLibelle(sprintf('import opds du %s', date('d M Y')));
+		$libelle = sprintf('import opds du %s', date('d M Y'));
+		if (!$category = Class_AlbumCategorie::getLoader()->findFirstBy(array('libelle' => $libelle)))
+			$category = Class_AlbumCategorie::getLoader()->newInstance()->setLibelle($libelle);
+
 		$category->save();
 
 		$album = Class_Album::getLoader()->newInstance()
-- 
GitLab