diff --git a/VERSIONS_HOTLINE/35768 b/VERSIONS_HOTLINE/35768 new file mode 100644 index 0000000000000000000000000000000000000000..ef5399ae088279f7acec278057b41975a9370fa0 --- /dev/null +++ b/VERSIONS_HOTLINE/35768 @@ -0,0 +1 @@ + - ticket #35768 : Correction du sélecteur de profil dans les outils d'adminitration situés en bas de page diff --git a/library/ZendAfi/Form/Decorator/ComboProfils.php b/library/ZendAfi/Form/Decorator/ComboProfils.php index 6ea743b79a59c706beeba02bd755f461298e0b29..712b7b3344ab8ca6aba5997104a3d9e8f8f80bc9 100644 --- a/library/ZendAfi/Form/Decorator/ComboProfils.php +++ b/library/ZendAfi/Form/Decorator/ComboProfils.php @@ -25,8 +25,7 @@ class ZendAfi_Form_Decorator_ComboProfils extends Zend_Form_Decorator_Abstract { return $content . $this->_element->getView() ->comboProfils($this->_element->getProfil(), - $this->_element->profil_filter - ); + $this->_element->profil_filter); } } ?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/ComboProfils.php b/library/ZendAfi/View/Helper/ComboProfils.php index be548dd9c236d4d1467f4f2a9bbe93c6b62a9509..4e431b4c6302f31a6e711922db3c26702d696c0e 100644 --- a/library/ZendAfi/View/Helper/ComboProfils.php +++ b/library/ZendAfi/View/Helper/ComboProfils.php @@ -28,11 +28,13 @@ class ZendAfi_View_Helper_ComboProfils extends ZendAfi_View_Helper_BaseHelper { $_id_zone, $_id_bib; - public function comboProfils($id_zone='ALL', $id_bib='ALL', $id_profil=1, - $autoload=false, $empty_option=false) { + + public function comboProfils($id_zone='ALL', $id_bib='ALL', $id_profil = 1, $autoload=false, $empty_option=false) { $this->_select_profil_id = $id_profil; + if ($empty_option) $this->addEmptyOption(); + $this->_id_zone = 'ALL'; $this->_id_bib = 'ALL'; @@ -73,7 +75,7 @@ class ZendAfi_View_Helper_ComboProfils extends ZendAfi_View_Helper_BaseHelper { $extra = ''; if ($autoload) - $extra = ' onchange="window.location=\''. Class_Url::baseUrl() . '?id_profil=\' + this.value"'; + $extra = ' onchange="window.location=\''. $this->getProfilUrl() . '\' + this.value"'; return sprintf('<label for="%s" style="display:none">'. $this->view->_('Profil'). @@ -86,6 +88,11 @@ class ZendAfi_View_Helper_ComboProfils extends ZendAfi_View_Helper_BaseHelper { } + protected function getProfilUrl() { + return $this->view->url(['id_profil' => ''], null, true); + } + + public function getProfilsByBib() { return Class_Profil::getProfilsByBib($this->_id_zone, $this->_id_bib); } diff --git a/tests/application/modules/opac/controllers/IndexControllerTest.php b/tests/application/modules/opac/controllers/IndexControllerTest.php index e8c5d76438f49ea7a5fb1c3ac2775d91d4b421f8..97291737ffdea87c7ec5879a740889ef55052d2d 100644 --- a/tests/application/modules/opac/controllers/IndexControllerTest.php +++ b/tests/application/modules/opac/controllers/IndexControllerTest.php @@ -124,7 +124,13 @@ class IndexControllerAsAdminWithCssEditorAndNoHeaderCss extends IndexControllerA /** @test */ public function comboProfilOnChangeShouldContainsBaseUrl() { - $this->assertXPath('//div[@class="footer"]//select[@id="select_clef_profil"][contains(@onchange, "' . Class_Url::baseUrl() . '?id_profil=")]'); + $this->assertXPath('//div[@class="footer"]//select[@id="select_clef_profil"][contains(@onchange, "\'/index/index/id_profil/\' + this.value")]'); + } + + + /** @test */ + public function comboProfilCurrentProfilShouldBeOne() { + $this->assertXPath('//div[@class="footer"]//select[@id="select_clef_profil"]//option[@value="1"][@selected="selected"]'); } }