From 4d0e1ebd9dce93dfd0d54305f2e4a5f77ac91c93 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 19 Mar 2013 19:16:34 +0100 Subject: [PATCH] =?UTF-8?q?Impossibilit=C3=A9=20d'ajouter=20une=20cat?= =?UTF-8?q?=C3=A9gorie=20'vide'=20+=20suppression=20des=20espaces=20en=20d?= =?UTF-8?q?=C3=A9but=20et=20fin=20de=20cha=C3=AEne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index cfc295ba6..b0fd4a8f9 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -17,7 +17,7 @@ class configureController extends ActionController { if (Request::isPost ()) { $cats = Request::param ('categories', array ()); $ids = Request::param ('ids', array ()); - $newCat = Request::param ('new_category'); + $newCat = trim (Request::param ('new_category', '')); foreach ($cats as $key => $name) { if (strlen ($name) > 0) { @@ -32,14 +32,17 @@ class configureController extends ActionController { } } - if ($newCat != false) { + if ($newCat != '') { $cat = new Category ($newCat); $values = array ( 'id' => $cat->id (), 'name' => $cat->name (), 'color' => $cat->color () ); - $catDAO->addCategory ($values); + + if ($catDAO->searchByName ($newCat) == false) { + $catDAO->addCategory ($values); + } } // notif