summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-09-14 17:48:33 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-09-14 17:48:33 +0200
commitadc33811c3c9513ca56dfa5e57169a5a1df106db (patch)
treefc76930a2221a807cd8373f8f02ebab639d19f83
parent31a6a13268023a2db5eba2445ee6c7db4a6d9623 (diff)
Fix issue #158 : ajout premier flux fonctionne
La catégorie par défaut est bien mise par défaut pour le premier flux
-rwxr-xr-xapp/controllers/configureController.php3
-rwxr-xr-xapp/controllers/feedController.php10
-rwxr-xr-xapp/models/Category.php2
3 files changed, 11 insertions, 4 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php
index 6396dbfeb..a31f5582e 100755
--- a/app/controllers/configureController.php
+++ b/app/controllers/configureController.php
@@ -8,6 +8,9 @@ class configureController extends ActionController {
array ('error' => array (Translate::t ('access_denied')))
);
}
+
+ $catDAO = new CategoryDAO ();
+ $catDAO->checkDefault ();
}
public function categorizeAction () {
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php
index 18a46f322..8cb4c31c2 100755
--- a/app/controllers/feedController.php
+++ b/app/controllers/feedController.php
@@ -9,14 +9,18 @@ class feedController extends ActionController {
);
}
- $catDAO = new CategoryDAO ();
- $catDAO->checkDefault ();
+ $this->catDAO = new CategoryDAO ();
+ $this->catDAO->checkDefault ();
}
public function addAction () {
if (Request::isPost ()) {
$url = Request::param ('url_rss');
- $cat = Request::param ('category');
+ $cat = Request::param ('category', false);
+ if ($cat === false) {
+ $def_cat = $this->catDAO->getDefault ();
+ $cat = $def_cat->id ();
+ }
$user = Request::param ('username');
$pass = Request::param ('password');
$params = array ();
diff --git a/app/models/Category.php b/app/models/Category.php
index e733b15ba..a9f036a4e 100755
--- a/app/models/Category.php
+++ b/app/models/Category.php
@@ -175,7 +175,7 @@ class CategoryDAO extends Model_pdo {
public function checkDefault () {
$def_cat = $this->searchById ('000000');
- if (!$def_cat) {
+ if ($def_cat === false) {
$cat = new Category (Translate::t ('default_category'));
$cat->_id ('000000');