From 0ae1a00f23bbe2fc7f7d23732e0437a1947b9f25 Mon Sep 17 00:00:00 2001 From: pierre oudot <poudot@afi-sa.fr> Date: Fri, 28 Jul 2023 15:41:41 +0000 Subject: [PATCH] Hotline #182736 : Fix Kiosque : PHP 8.1 type issues --- VERSIONS_HOTLINE/182736 | 1 + .../ZendAfi/View/Helper/Accueil/Kiosque.php | 14 ++++---- .../IndexControllerArticlesWidgetTest.php | 36 +++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 VERSIONS_HOTLINE/182736 diff --git a/VERSIONS_HOTLINE/182736 b/VERSIONS_HOTLINE/182736 new file mode 100644 index 00000000000..3958c6b4b8f --- /dev/null +++ b/VERSIONS_HOTLINE/182736 @@ -0,0 +1 @@ + - correctif #182736 : Opac : passage en 8.1, résolution du problème de chargement des kiosques. \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/Kiosque.php b/library/ZendAfi/View/Helper/Accueil/Kiosque.php index e44e69675ab..7e8ac554ea5 100644 --- a/library/ZendAfi/View/Helper/Accueil/Kiosque.php +++ b/library/ZendAfi/View/Helper/Accueil/Kiosque.php @@ -165,7 +165,9 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba case 'slide_show': $controler = 'java'; $this->preferences['vue']='slide_show'; - $hauteur = $this->preferences['op_hauteur_img'] + 7; + $hauteur = $this->preferences['op_hauteur_img'] + ? (int)$this->preferences['op_hauteur_img'] + 7 + : 117; if ($hauteur == 7) $hauteur = 117; break; @@ -177,27 +179,27 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba case 'cube': $controler = 'java'; $this->preferences['vue'] = 'cube'; - $hauteur = $this->preferences['op_hauteur_img'] + 20; + $hauteur = (int)$this->preferences['op_hauteur_img'] + 20; break; case 'diaporama': $controler = 'java'; $this->preferences['vue'] = 'diaporama'; - $hauteur = $this->preferences['op_hauteur_boite']; + $hauteur = (int)$this->preferences['op_hauteur_boite']; break; case 'jcarousel': $controler = 'java'; $this->preferences['vue'] = 'jcarousel'; - $hauteur = $this->preferences['op_hauteur_img'] + 10; + $hauteur = (int)$this->preferences['op_hauteur_img'] + 10; break; case 'mycarousel_horizontal': $controler = 'java'; $this->preferences['vue'] = 'mycarousel_horizontal'; - $hauteur = $this->preferences['op_hauteur_img'] + 5; + $hauteur = (int)$this->preferences['op_hauteur_img'] + 5; break; case 'mycarousel_vertical': $controler = 'java'; $this->preferences['vue'] = 'mycarousel_vertical'; - $hauteur = ($this->preferences['op_visible'] * $this->preferences['op_hauteur_img']) + 15; + $hauteur = ((int)$this->preferences['op_visible'] * (int) $this->preferences['op_hauteur_img']) + 15; break; case 'coverflow': $controler = 'flash'; diff --git a/tests/application/modules/opac/controllers/IndexControllerArticlesWidgetTest.php b/tests/application/modules/opac/controllers/IndexControllerArticlesWidgetTest.php index 396f430be31..0aac99cc88f 100644 --- a/tests/application/modules/opac/controllers/IndexControllerArticlesWidgetTest.php +++ b/tests/application/modules/opac/controllers/IndexControllerArticlesWidgetTest.php @@ -54,3 +54,39 @@ class IndexControllerArticlesWidgetAccordionPrintTest extends AbstractController $this->assertXPath('//a[contains(@href, "/cms/print/ids/12/strategy/Article_List")]'); } } + + + + +/* @see https://forge.afi-sa.net/issues/182736 */ +class IndexControllerArticlesWidgetKiosqueTest extends AbstractControllerTestCase { + + + public function setUp() { + parent::setUp(); + } + + public function getStyleListe(){ + return [ + ['slide_show', '117'], + ['cube', '20'], + ['jcarousel', '10'], + ['mycarousel_horizontal', '5'], + ['mycarousel_vertical', '15'], + ]; + } + + + /** + * @dataProvider getStyleListe + * @test + */ + public function pageShouldBeDisplayedEvenWhenPreferencesContainsStringValueInsteadOfInt($style_list, $expected_height) { + Class_Profil::getCurrentProfil() + ->setBoiteOfTypeInDivision(1, Class_Systeme_ModulesAccueil_Kiosque::CODE, + ['style_liste'=> $style_list, + 'op_hauteur_img' => '']); + $this->dispatch('opac/index/index'); + $this->assertXPath('//iframe[@height="'.$expected_height.'"]'); + } +} -- GitLab