summaryrefslogtreecommitdiff
path: root/app/models/Category.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-17 15:13:19 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-17 15:13:19 +0100
commitfd171e8f9517dd5a046d4f7f159cde3002e7706a (patch)
treeb236935155c0da7e61ddd9f73bce6474fc581f4b /app/models/Category.php
parent001c425acd3345e363fe36c014f776069dd587dc (diff)
Fix bug #31 : catégorie par défaut ne peut plus être supprimée mais peut être renommée. Ajout gestion flux tronqués directement dans l'interface (+ intégré en base de données). Attention, la BDD a changé (+ 4 champs : 2 pour feed, 2 pour entry)
Diffstat (limited to 'app/models/Category.php')
-rwxr-xr-xapp/models/Category.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/app/models/Category.php b/app/models/Category.php
index a7f900880..d7db8ee65 100755
--- a/app/models/Category.php
+++ b/app/models/Category.php
@@ -13,7 +13,7 @@ class Category extends Model {
public function id () {
if (!$this->id) {
- return small_hash ($this->name . Configuration::selApplication ());
+ return small_hash ($this->name . time () . Configuration::selApplication ());
} else {
return $this->id;
}
@@ -152,11 +152,12 @@ class CategoryDAO extends Model_pdo {
return HelperCategory::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC));
}
- public function getDefault () {
- $def_cat = $this->searchByName ('Sans catégorie');
+ public function checkDefault () {
+ $def_cat = $this->searchById ('000000');
if (!$def_cat) {
$cat = new Category ('Sans catégorie');
+ $cat->_id ('000000');
$values = array (
'id' => $cat->id (),
@@ -165,11 +166,7 @@ class CategoryDAO extends Model_pdo {
);
$this->addCategory ($values);
-
- $def_cat = $cat;
}
-
- return $def_cat;
}
public function count () {