Commit f2cdffef authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'hotline#74510_dysfonctionnement_des_boites_sitotheques_en_frontoffice' into 'hotline'

hotline #74510 fix display_order param

See merge request afi/opacce!2640
parents 5dfdc05f aa893c89
- ticket #74510 : Boite sitothèque : correction du paramètre "ordre d'affichage" "sites les plus récents".
\ No newline at end of file
......@@ -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),
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment