From a69060e6392042ecaede1cf78760e289eca38d6d Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@afi-sa.fr> Date: Tue, 21 May 2019 16:22:25 +0200 Subject: [PATCH] hotline#91377 : fix duplicates articles in 2 columns box --- VERSIONS_HOTLINE/91377 | 1 + library/Class/Profil.php | 2 +- .../ModulesAccueil/ConteneurDeuxColonnes.php | 3 ++- library/ZendAfi/View/Helper/Portail.php | 4 ++- .../opac/controllers/IndexControllerTest.php | 26 +++++++++++++++++++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 VERSIONS_HOTLINE/91377 diff --git a/VERSIONS_HOTLINE/91377 b/VERSIONS_HOTLINE/91377 new file mode 100644 index 00000000000..223a16478d4 --- /dev/null +++ b/VERSIONS_HOTLINE/91377 @@ -0,0 +1 @@ + - ticket #91377 : Affichage boite 2 colonnes : problème de duplication des articles \ No newline at end of file diff --git a/library/Class/Profil.php b/library/Class/Profil.php index 113a15d3acd..ebccc2da9e6 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -2348,7 +2348,7 @@ class Class_Profil extends Storm_Model_Abstract { foreach($modules as $key => $module) { if( $module['type_module'] == $type_module && $module['parent_id'] == $id - && $key >= 1000 + && $key >= Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes::MODULE_ID_SHIFT && $key == $two_cols_pref['col_' . $colonne . '_module_id']) return $key; } diff --git a/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php b/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php index 206b9ea4df6..c92bd8e0a1b 100644 --- a/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php +++ b/library/Class/Systeme/ModulesAccueil/ConteneurDeuxColonnes.php @@ -21,6 +21,7 @@ class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_ModulesAccueil_Null { const CODE = 'CONTENEUR_DEUX_COLONNES'; + const MODULE_ID_SHIFT = 1000; protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, @@ -77,7 +78,7 @@ class Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes extends Class_Systeme_M public static function getOrCreateModuleForCol($profil, $id, $type_module, $colonne) { if(!$id = $profil->getModuleIdFromCol($id, $type_module, $colonne)) - return $profil->createNewModuleAccueilId(1000); + return $profil->createNewModuleAccueilId(static::MODULE_ID_SHIFT); return $id; } diff --git a/library/ZendAfi/View/Helper/Portail.php b/library/ZendAfi/View/Helper/Portail.php index 184446f9d78..4f50bdddead 100644 --- a/library/ZendAfi/View/Helper/Portail.php +++ b/library/ZendAfi/View/Helper/Portail.php @@ -30,7 +30,9 @@ class ZendAfi_View_Helper_Portail extends ZendAfi_View_Helper_BaseHelper { $ret[$division_demandee] = ''; foreach ($cfg_accueil["modules"] as $id_module => $module) { - if ($id_module === null) continue; + if ($id_module === null + || Class_Systeme_ModulesAccueil_ConteneurDeuxColonnes::MODULE_ID_SHIFT <= $id_module) + continue; $helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelperFromParams($id_module, $module, $this->view); if (!$helper) continue; diff --git a/tests/application/modules/opac/controllers/IndexControllerTest.php b/tests/application/modules/opac/controllers/IndexControllerTest.php index 9b090e54950..c19820286c5 100644 --- a/tests/application/modules/opac/controllers/IndexControllerTest.php +++ b/tests/application/modules/opac/controllers/IndexControllerTest.php @@ -968,4 +968,30 @@ class IndexControllerSiteDownActionTest extends AbstractControllerTestCase { public function frontNavCssShouldBeLoaded() { $this->assertXPath('//link[contains(@href, "front_nav.css")]'); } +} + + + +class IndexControllerPageWithDoubleColumnsTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + $this->onLoaderOfModel('Class_Article') + ->whenCalled('getArticlesByPreferences') + ->answers([]); + + $this->fixture('Class_Profil', + ['id' => 3, + 'cfg_accueil' => 'a:4:{s:7:"modules";a:15:{i:7;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:11:"RECH_SIMPLE";s:11:"preferences";a:19:{s:5:"titre";s:0:"";s:7:"message";s:0:"";s:7:"exemple";s:0:"";s:10:"select_bib";s:1:"0";s:10:"select_doc";s:1:"0";s:13:"select_annexe";s:1:"0";s:7:"largeur";s:3:"140";s:17:"recherche_avancee";s:2:"on";s:8:"type_doc";s:0:"";s:3:"tri";s:1:"*";s:15:"profil_redirect";s:1:"3";s:11:"placeholder";s:36:"Rechercher àCroissy et au Vésinet";s:13:"search_button";s:0:"";s:10:"domain_ids";s:0:"";s:19:"domain_select_style";s:6:"select";s:5:"boite";s:22:"boite_recherche_simple";s:9:"id_module";s:1:"7";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:5;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:20:{s:5:"titre";s:15:"INFOS PRATIQUES";s:6:"anchor";s:0:"";s:19:"allow_link_on_title";s:1:"1";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:7:"269-267";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:1:"0";s:8:"rss_avis";s:1:"0";s:14:"op_largeur_img";s:3:"200";s:6:"layout";s:4:"grid";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:19:"boite_titre_encadre";s:9:"id_module";s:1:"5";s:11:"style_liste";s:4:"none";s:13:"styles_reload";s:1:"0";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:8;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:11:{s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:11:"toggle_menu";s:1:"0";s:4:"menu";s:3:"3-5";s:5:"boite";s:20:"boite_titre_souligne";s:5:"titre";s:0:"";s:9:"id_module";s:1:"8";s:10:"profile_id";s:1:"3";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:1;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:8:{s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:11:"toggle_menu";s:1:"0";s:4:"menu";s:3:"3-8";s:5:"boite";s:20:"boite_titre_souligne";s:5:"titre";s:0:"";s:9:"id_module";s:1:"1";}}i:11;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:10:{s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:11:"toggle_menu";s:1:"0";s:4:"menu";s:3:"3-6";s:5:"boite";s:20:"boite_titre_souligne";s:5:"titre";s:0:"";s:9:"id_module";s:2:"11";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:4;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:8:{s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:11:"toggle_menu";s:1:"0";s:4:"menu";s:3:"3-9";s:5:"boite";s:20:"boite_titre_souligne";s:5:"titre";s:0:"";s:9:"id_module";s:1:"4";}}i:6;a:3:{s:8:"division";s:1:"2";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:40:{s:5:"titre";s:0:"";s:6:"anchor";s:0:"";s:19:"allow_link_on_title";s:1:"1";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:9:"2284-2239";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:2:"50";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:1:"0";s:8:"rss_avis";s:1:"0";s:14:"op_largeur_img";s:2:"85";s:6:"layout";s:4:"grid";s:16:"op_hauteur_boite";s:1:"0";s:5:"boite";s:0:"";s:9:"id_module";s:1:"6";s:10:"profile_id";s:1:"3";s:11:"style_liste";s:20:"diaporama_navigation";s:10:"nb_notices";s:2:"30";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:14:"op_hauteur_img";s:3:"115";s:13:"op_transition";s:0:"";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:12:"id_catalogue";s:3:"156";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:0:"";s:0:"";s:13:"styles_reload";s:1:"0";s:18:"op_navigation_mode";s:13:"next_previous";s:18:"op_navigation_unit";s:1:"%";s:26:"op_navigation_window_width";s:3:"100";s:27:"op_navigation_window_height";s:3:"490";s:19:"op_navigation_cycle";s:5:"10000";}}i:1000;a:6:{s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:23:{s:5:"titre";s:10:"Animations";s:6:"anchor";s:0:"";s:19:"allow_link_on_title";s:1:"0";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:13:"2286-246-2269";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:1:"0";s:8:"rss_avis";s:1:"0";s:14:"op_largeur_img";s:3:"200";s:6:"layout";s:4:"grid";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:25:"boite_titre_sous_la_barre";s:10:"profile_id";s:1:"3";s:11:"style_liste";s:20:"diaporama_navigation";s:13:"styles_reload";s:1:"0";s:18:"op_navigation_mode";s:7:"buttons";s:18:"op_navigation_unit";s:1:"%";s:26:"op_navigation_window_width";s:3:"100";s:27:"op_navigation_window_height";s:3:"250";s:19:"op_navigation_cycle";s:1:"0";}s:9:"id_module";s:4:"1000";s:9:"parent_id";s:2:"12";s:10:"profile_id";s:1:"3";s:8:"division";s:1:"2";}i:0;a:1:{s:8:"division";s:1:"2";}i:1001;a:6:{s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:23:{s:5:"titre";s:10:"ACTUALITES";s:6:"anchor";s:0:"";s:19:"allow_link_on_title";s:1:"0";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:29:"2297-1961-2238-2208-2115-1950";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:1:"0";s:8:"rss_avis";s:1:"0";s:14:"op_largeur_img";s:3:"200";s:6:"layout";s:4:"grid";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:25:"boite_titre_sous_la_barre";s:10:"profile_id";s:1:"3";s:11:"style_liste";s:20:"diaporama_navigation";s:13:"styles_reload";s:1:"0";s:18:"op_navigation_mode";s:7:"buttons";s:18:"op_navigation_unit";s:2:"px";s:26:"op_navigation_window_width";s:3:"420";s:27:"op_navigation_window_height";s:3:"240";s:19:"op_navigation_cycle";s:4:"5000";}s:9:"id_module";s:4:"1001";s:9:"parent_id";s:2:"12";s:10:"profile_id";s:1:"3";s:8:"division";s:1:"2";}i:12;a:5:{s:11:"type_module";s:23:"CONTENEUR_DEUX_COLONNES";s:11:"preferences";a:11:{s:5:"titre";s:0:"";s:15:"col_gauche_type";s:4:"NEWS";s:15:"col_droite_type";s:4:"NEWS";s:5:"boite";s:0:"";s:9:"id_module";s:2:"12";s:11:"type_module";s:23:"CONTENEUR_DEUX_COLONNES";s:8:"division";s:1:"2";s:8:"rss_avis";s:1:"0";s:20:"col_gauche_module_id";s:4:"1000";s:20:"col_droite_module_id";s:4:"1001";s:10:"profile_id";s:1:"3";}s:10:"profile_id";s:1:"3";s:8:"division";s:1:"2";s:20:"col_gauche_module_id";s:4:"1000";}i:3;a:3:{s:8:"division";s:1:"2";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:27:{s:5:"titre";s:42:"Nos coups de coeur Jeunesse - 2017 à2019";s:11:"style_liste";s:9:"jcarousel";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:3:"120";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:2:"90";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"2";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"0";s:12:"id_catalogue";s:3:"134";s:9:"id_panier";s:0:"";s:15:"profil_redirect";s:1:"3";s:5:"boite";s:20:"boite_titre_souligne";s:9:"id_module";s:1:"3";s:11:"type_module";s:7:"KIOSQUE";s:8:"division";s:1:"2";s:13:"styles_reload";s:1:"0";s:10:"profile_id";s:1:"3";}}i:2;a:3:{s:8:"division";s:1:"4";s:11:"type_module";s:11:"RECH_SIMPLE";s:11:"preferences";a:23:{s:5:"titre";s:0:"";s:7:"message";s:0:"";s:7:"exemple";s:0:"";s:10:"select_bib";s:1:"0";s:10:"select_doc";s:1:"0";s:13:"select_annexe";s:1:"0";s:7:"largeur";s:3:"140";s:17:"recherche_avancee";s:1:"0";s:8:"type_doc";s:0:"";s:3:"tri";s:1:"*";s:15:"profil_redirect";s:1:"1";s:11:"placeholder";s:31:"Rechercher dans tout le réseau";s:13:"search_button";s:0:"";s:10:"domain_ids";s:0:"";s:19:"domain_select_style";s:6:"select";s:5:"boite";s:0:"";s:9:"id_module";s:1:"2";s:11:"type_module";s:11:"RECH_SIMPLE";s:8:"division";s:1:"4";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";s:8:"id_items";s:0:"";s:8:"rss_avis";s:1:"0";}}i:10;a:3:{s:8:"division";s:1:"4";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:10:{s:14:"afficher_titre";s:1:"0";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"1";s:11:"toggle_menu";s:1:"0";s:4:"menu";s:3:"1-H";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:9:"id_module";s:2:"10";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:9;a:3:{s:8:"division";s:1:"4";s:11:"type_module";s:5:"LOGIN";s:11:"preferences";a:20:{s:5:"titre";s:12:"Se connecter";s:14:"titre_connecte";s:0:"";s:11:"identifiant";s:20:"N° de carte-lecteur";s:19:"identifiant_exemple";s:0:"";s:12:"mot_de_passe";s:24:"année naissance lecteur";s:20:"mot_de_passe_exemple";s:0:"";s:14:"lien_connexion";s:12:"Se connecter";s:24:"lien_mot_de_passe_oublie";s:22:"Mot de passe oublié ?";s:17:"lien_creer_compte";s:0:"";s:16:"pre-registration";s:0:"";s:16:"message_connecte";s:7:"Bonjour";s:11:"lien_compte";s:10:"Mon compte";s:17:"lien_deconnection";s:0:"";s:16:"pre_registration";s:0:"";s:16:"autocomplete_off";s:1:"1";s:15:"profil_redirect";s:0:"";s:22:"profil_logout_redirect";s:0:"";s:5:"boite";s:20:"boite_login_banniere";s:9:"id_module";s:1:"9";s:0:"";s:0:"";}}}s:14:"use_parent_css";s:1:"1";s:7:"sitemap";s:1:"1";s:8:"page_css";s:0:"";}' + ]); + $this->dispatch('/opac/index/index/id_profil/3'); + } + + + /** @test */ + public function pageShouldNotContainsDuplicateArticles() { + $this->assertXPathCount('//div[@id="boite_1000"]', 1); + $this->assertXPathCount('//div[@id="boite_1001"]', 1); + } } \ No newline at end of file -- GitLab