aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/configureController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-19 19:16:34 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-19 19:16:34 +0100
commit4d0e1ebd9dce93dfd0d54305f2e4a5f77ac91c93 (patch)
treee4df91ad0311b5167177eb1b7b8b3954322127db /app/controllers/configureController.php
parent4b5c458a00f234736402a745dfeca008a9086e59 (diff)
Impossibilité d'ajouter une catégorie 'vide' + suppression des espaces en début et fin de chaîne
Diffstat (limited to 'app/controllers/configureController.php')
-rwxr-xr-xapp/controllers/configureController.php9
1 files 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