diff --git a/VERSIONS_HOTLINE/74510 b/VERSIONS_HOTLINE/74510 new file mode 100644 index 0000000000000000000000000000000000000000..09f8950be778af7ae79f53843f2d0733fc1232c1 --- /dev/null +++ b/VERSIONS_HOTLINE/74510 @@ -0,0 +1,2 @@ + - ticket #74510 : Boite sitothèque : correction du paramètre "ordre d'affichage" "sites les plus récents". + \ No newline at end of file diff --git a/library/Class/Sitotheque.php b/library/Class/Sitotheque.php index 02e3367218bcf4f90360c296efe201999f7b4f6f..328ce32615d971d90ee3867a45376c543bef15de 100644 --- a/library/Class/Sitotheque.php +++ b/library/Class/Sitotheque.php @@ -47,12 +47,12 @@ class SitothequeLoader extends Storm_Model_Loader { foreach ($id_sites as $id_site) { if ($id_site) - $feeds[] = $this->find($id_site); + $feeds[] = Class_Sitotheque::find($id_site); } $categories = []; foreach ($id_categories as $id_cat) { - if ($categorie = Class_SitothequeCategorie::getLoader()->find($id_cat)) { + if ($categorie = Class_SitothequeCategorie::find($id_cat)) { $categories = array_merge($categories, $categorie->getRecursiveSousCategories()); $categories[] = $categorie; } @@ -75,7 +75,7 @@ class SitothequeLoader extends Storm_Model_Loader { public function getLastSitos($id_category, $id_items, $limit) { - if ($id_category) { + if ($id_category || $id_items) { $sitos = Class_Sitotheque::getSitesFromIdsAndCategories( explode('-', $id_items), explode('-', $id_category), diff --git a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php index d8576828602b350f30e2a0dc5ba4fb88d57bcac0..9c3b8bfa23f24ca74cb7107756b999da46ec16c1 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php @@ -603,4 +603,33 @@ class SitoViewHelperHierarchicalCategoryTest extends SitoViewHelperTestCase { '//h2//a[contains(@href, "/sito/viewcategory/id_cat/23/start_cat/23")]', 'La Creuse'); } +} + + + +/* @ see hotline http://forge.afi-sa.fr/issues/74510 */ +class SitoViewHelperSelectItemsByRecentOrderTest extends SitoViewHelperTestCase { + protected $_preferences = ['titre' => 'Ma sito', + 'type_aff' => 1, + 'id_items' => '12-15', + 'id_categorie' => '', + 'nb_aff' => 6, + 'rss' => 1, + 'display_order' => 'Recent']; + + + protected function addFixturesSito() { + parent::addFixturesSito(); + $this->onLoaderOfModel('Class_Sitotheque') + ->whenCalled('getSitesFromIdsAndCategories'); + } + + + /** @test */ + public function shouldFindWithItemSelection() { + $this->assertTrue(Class_Sitotheque::methodHasBeenCalledWithParams('getSitesFromIdsAndCategories', + [[12,15], + [''], + true])); + } } \ No newline at end of file