diff --git a/cosmogramme/VERSIONS_WIP/64573 b/cosmogramme/VERSIONS_WIP/64573 deleted file mode 100644 index cef84909869649ef2a549c853128224f41880e8c..0000000000000000000000000000000000000000 --- a/cosmogramme/VERSIONS_WIP/64573 +++ /dev/null @@ -1 +0,0 @@ - - ticket #64573 : Amélioration de la charte modele \ No newline at end of file diff --git a/library/Class/Feature.php b/library/Class/Feature.php index 4a4da8e0fb858665e7ea2c198e086898de95a9e8..bfadd212c88d0033ada0884c40721428401bedf4 100644 --- a/library/Class/Feature.php +++ b/library/Class/Feature.php @@ -29,7 +29,7 @@ class Class_Feature { public function hasNew() { - return 1 <= $this->countNew(); + return 0 < $this->countNew(); } @@ -80,8 +80,7 @@ class Class_Feature { if(!$ids) return []; - return array_values((new Storm_Collection(array_map([$this, 'find'], $ids))) - ->getArrayCopy()); + return array_values(array_map([$this, 'find'], $ids)); } diff --git a/library/Class/User/Settings.php b/library/Class/User/Settings.php index afc89ca097d26a63e61eea700f5cb2930d05b4f1..908c4ff318363ef4e0b8342d85d47a7cb8a51504 100644 --- a/library/Class/User/Settings.php +++ b/library/Class/User/Settings.php @@ -195,26 +195,26 @@ class Class_User_Settings { public function addCheckedFeature($id) { - $checked_features = $this->get(static::CHECKED_FEATURE); - $checked_features = explode('-', $checked_features); - $checked_features = array_values(array_unique(array_merge($checked_features, - [$id]))); + $checked_features = $this->_getCheckedFeatures($id); $this->set(static::CHECKED_FEATURE, implode('-', $checked_features)); return $this->_user; } public function removeCheckedFeature($id) { - $checked_features = $this->get(static::CHECKED_FEATURE); - $checked_features = explode('-', $checked_features); - $checked_features = array_values(array_unique(array_merge($checked_features, - [$id]))); - $checked_features = array_diff($checked_features, [$id]); + $checked_features = array_diff($this->_getCheckedFeatures($id), [$id]); $this->set(static::CHECKED_FEATURE, implode('-', $checked_features)); return $this->_user; } + protected function _getCheckedFeatures($id) { + $checked_features = explode('-', $this->get(static::CHECKED_FEATURE)); + return array_values(array_unique(array_merge($checked_features, + [$id]))); + } + + public function addLibraryToBookmarks($id) { if (!static::isBookmarkLibraryReady()) return $this->_user;