diff --git a/VERSIONS_HOTLINE/123849 b/VERSIONS_HOTLINE/123849 new file mode 100644 index 0000000000000000000000000000000000000000..25d071bc9024cc9e2b2635ce0b10fc778078ef0d --- /dev/null +++ b/VERSIONS_HOTLINE/123849 @@ -0,0 +1 @@ + - ticket #123849 : Correctif sur la gestion des favoris, il est maintenant possible de selectionner des domaines favoris sans selectionner de bibliothèques favorites si la variable "ENABLE_BOOKMARKABLE_LIBRARIES" est désactivée. \ No newline at end of file diff --git a/application/modules/opac/controllers/AbonneController.php b/application/modules/opac/controllers/AbonneController.php index 8ad77132b55f0aada354c77453b6526d5ae8e456..e94a952c3bfab6662f93fc61de415ef534b29544 100644 --- a/application/modules/opac/controllers/AbonneController.php +++ b/application/modules/opac/controllers/AbonneController.php @@ -1162,7 +1162,8 @@ class AbonneController extends ZendAfi_Controller_Action { $this->view->form = $form = ZendAfi_Form_User_Settings::forUser($this->_user); - if ($this->_request->isPost() && !$this->_getParam('library_ids')) { + if ($this->_request->isPost() && !$this->_getParam('library_ids') + && Class_AdminVar::isModuleEnabled('ENABLE_BOOKMARKABLE_LIBRARIES')) { $this->_helper->notify($this->_('Au moins une bibliothèque favorite doit être sélectionnée!')); return $this->_redirectToReferer(); } diff --git a/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php b/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php index ef7c68cc7f260e3fb4bff7594858af943ac3a722..bba27d69df0dafc079cbba347e45b2ca9c294042 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php @@ -241,6 +241,40 @@ class AbonneControllerSettingsFormPostTest extends AbonneControllerSettingsTestC } + + +class AbonneControllerSettingsBookmarkedLibDisabledTest extends AbonneControllerSettingsTestCase { + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Bib', + ['id' => 59, + 'libelle' => 'ANNECY']); + + Class_AdminVar::set('ENABLE_BOOKMARKABLE_LIBRARIES', false); + + $this->postDispatch('/abonne/manage-settings', + ['domain_ids' => '1-2']); + } + + + /** @test */ + public function userSettingsShouldHaveBeenUpdated() { + $this->assertEquals([$this->_music, $this->_sport], $this->_user->getBookmarkedDomains()); + } + + + /** @test */ + public function userSettingsShouldHaveBeenUpdatedWithNoLibs() { + $this->assertEquals(0, count($this->_user->getBookmarkedLibraries())); + } +} + + + + + class AbonneControllerSettingsFormChangeTest extends AbonneControllerSettingsTestCase { public function setUp() { @@ -250,6 +284,8 @@ class AbonneControllerSettingsFormChangeTest extends AbonneControllerSettingsTes ['id' => 59, 'libelle' => 'ANNECY']); + Class_AdminVar::set('ENABLE_BOOKMARKABLE_LIBRARIES', true); + $this->_user ->setBookmarkedLibraries([56]) ->save();