diff --git a/VERSIONS_HOTLINE/90704 b/VERSIONS_HOTLINE/90704 new file mode 100644 index 0000000000000000000000000000000000000000..9b19ce5a3b93b540b95920c3f394747fb4da8c04 --- /dev/null +++ b/VERSIONS_HOTLINE/90704 @@ -0,0 +1 @@ + - ticket #90704 : Boite Calendrier : Correction de la prise en compte du paramètre Ordre d'Affichage. \ No newline at end of file diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index 902925d5d8a8c9860782ad5dcf72eaa0298f3a52..5c6105213c272807ab9c39d123cd30d9360ba6be 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -234,10 +234,10 @@ class CmsController extends ZendAfi_Controller_Action { $module_calendrier = new Class_Systeme_ModulesAccueil_Calendrier(); $preferences = array_merge($module_calendrier->getDefaultValues(), - $this->_modulesPreferences($id_module)); + Class_Profil::getCurrentProfil()->getModuleAccueilPreferences($id_module, 'CALENDAR')); $preferences['ID_MODULE'] = $id_module; $preferences['SELECT_ID_CAT'] = $preferences['display_cat_select'] - ? $this->_getParam('select_id_categorie') + ? $this->_getParam('select_id_categorie') : 'all'; $this->view->calendar = new Class_Calendar($id_module, @@ -255,7 +255,7 @@ class CmsController extends ZendAfi_Controller_Action { * @param int $id_profil * @return array */ - private function _modulesPreferences($id_module, $id_profil = null, $id_menu = null) { + protected function _modulesPreferences($id_module, $id_profil = null, $id_menu = null) { $profil = ($id_profil) ? Class_Profil::find($id_profil) : Class_Profil::getCurrentProfil(); diff --git a/library/Class/Calendar.php b/library/Class/Calendar.php index e2e3a873809d9fd5f20dc74509f3661eed64bcff..44ad270138d544bf8bff964d4dbd36b5dd51ca70 100644 --- a/library/Class/Calendar.php +++ b/library/Class/Calendar.php @@ -153,7 +153,7 @@ class Class_Calendar { protected function _loadArticles($extra_prefs) { - $prefs = array_merge(['display_order' => 'EventDebut', + $prefs = array_merge(['display_order' => $this->preferences['display_order'], 'id_categorie' => $this->_getCategoriesIds(), 'events_only' => true, 'event_date' => $this->date, diff --git a/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php b/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php index a9a17a86089bcb6e6da84e0dea971aeadb9bc543..eb14bcff09501969ad7c17764e3146fe9dcd57f7 100644 --- a/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php @@ -593,7 +593,7 @@ class CmsControllerCalendarActionWithDayTest extends AbstractControllerTestCase class CmsControllerCalendarActionHeaderTest extends AbstractControllerTestCase { - + protected $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); @@ -617,6 +617,10 @@ class CmsControllerCalendarActionHeaderTest extends AbstractControllerTestCase { ]; + $this->onLoaderOfModel('Class_Article') + ->whenCalled('getArticlesByPreferences') + ->answers([]); + $this->fixture('Class_Profil', ['id' => 4, 'browser' => 'opac', @@ -639,6 +643,7 @@ class CmsControllerCalendarActionHeaderTest extends AbstractControllerTestCase { class CmsControllerCalendarActionAjaxLinkTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); @@ -1056,7 +1061,10 @@ class CmsControllerCalendarActionIcalExportRecurrentAllDayTest + class CmsControllerCalendarActionWithOutDateTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); diff --git a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php index 3d721cc059589220f2a8432f214b20dda19f7f02..3a5e2cf2e35245824292ac89439b1fe9811b979b 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php @@ -471,38 +471,41 @@ class CalendarWithCategoryLimitAndBibPreferencesTest extends CalendarViewHelperT $this->params = array('division' => '2', 'type_module' => 'CALENDAR', - 'preferences' => array('titre' => 'Concerts !', - 'rss_avis' => '0', - 'id_categorie' => '12-3', - 'display_cat_select' => '', - 'display_event_info' => 'bib', - 'display_date' => '2011-03-17')); + 'preferences' => ['titre' => 'Concerts !', + 'rss_avis' => '0', + 'id_categorie' => '12-3', + 'display_cat_select' => '', + 'display_event_info' => 'bib', + 'display_order' => 'DebutPublicationDesc', + 'display_date' => '2011-03-17']); $helper = new ZendAfi_View_Helper_Accueil_Calendar(2, $this->params); $helper->setView(new ZendAfi_Controller_Action_Helper_View()); Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') ->whenCalled('getArticlesByPreferences') - ->with(array( - 'display_order' => 'EventDebut', - 'id_categorie' => '12-3', - 'event_date' => '2011-03', - 'id_bib' => 5, - 'id_lieu' => '', - 'custom_fields' => [], - 'events_only' => true, - 'published' => false)) - ->answers(array($this->nanook2, $this->opac4, $this->amber)) + ->with([ + 'display_order' => 'DebutPublicationDesc', + 'id_categorie' => '12-3', + 'event_date' => '2011-03', + 'id_bib' => 5, + 'id_lieu' => '', + 'custom_fields' => [], + 'events_only' => true, + 'published' => false + ]) + ->answers([$this->nanook2, $this->opac4, $this->amber]) ->whenCalled('getArticlesByPreferences') - ->with(array( - 'display_order' => 'EventDebut', - 'id_categorie' => '12-3', - 'events_only' => true, - 'event_date' => '2011-03-17', - 'id_bib' => 5, - 'id_lieu' => '', - 'custom_fields' => [], - 'published' => false)) - ->answers(array($this->nanook2, $this->opac4, $this->amber)) + ->with([ + 'display_order' => 'DebutPublicationDesc', + 'id_categorie' => '12-3', + 'events_only' => true, + 'event_date' => '2011-03-17', + 'id_bib' => 5, + 'id_lieu' => '', + 'custom_fields' => [], + 'published' => false + ]) + ->answers([$this->nanook2, $this->opac4, $this->amber]) ->beStrict();