diff --git a/VERSIONS_HOTLINE/37341 b/VERSIONS_HOTLINE/37341 new file mode 100644 index 0000000000000000000000000000000000000000..64ee4bc8e0e757785582f4eb12a7b7c13b8acf63 --- /dev/null +++ b/VERSIONS_HOTLINE/37341 @@ -0,0 +1 @@ + - ticket #37341 : CASQY : Correction de l'affichage des types docs en résultat de recherche \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Notice/FacettesTypeDoc.php b/library/ZendAfi/View/Helper/Notice/FacettesTypeDoc.php index fa3580a29fa3c3caa170a7d477c9d8fccef78726..90207bbe38d84425571bb16e9ccc4aa372817ac8 100644 --- a/library/ZendAfi/View/Helper/Notice/FacettesTypeDoc.php +++ b/library/ZendAfi/View/Helper/Notice/FacettesTypeDoc.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Notice_FacettesTypeDoc extends Zend_View_Helper_HtmlElement { public function notice_FacettesTypeDoc($facettes) { @@ -26,10 +26,10 @@ class ZendAfi_View_Helper_Notice_FacettesTypeDoc extends Zend_View_Helper_HtmlEl if (!isset($facettes['T'])) $facettes['T'] = []; - foreach($facettes['T'] as $facette) { - if (!is_array($facette)) - continue; - $html .= $this->renderFacette($facette['id'], $facette['libelle'], $facette['nombre']); + foreach($facettes['T'] as $code => $value) { + $label = Class_Codification::getInstance()->getLibelleFacette($code); + + $html .= $this->renderFacette($code, $label, $value); } return $html.'</div>'; @@ -37,7 +37,7 @@ class ZendAfi_View_Helper_Notice_FacettesTypeDoc extends Zend_View_Helper_HtmlEl public function renderFacette($id, $libelle, $nombre) { - return $this->view->tagAnchor(['facette' => $id], $nombre, + return $this->view->tagAnchor(['facette' => $id], $nombre, ['class' => 'type_doc_'.substr($id, 1 ), 'libelle' => $libelle]); } diff --git a/tests/library/ZendAfi/View/Helper/Notice/FacettesTypeDocTest.php b/tests/library/ZendAfi/View/Helper/Notice/FacettesTypeDocTest.php index 4383f1fea08caf4701d4c15ccd0cdf8dc5b8ba2a..cf14bfb1c8867a1afe3575cbb8f14153ee171f17 100644 --- a/tests/library/ZendAfi/View/Helper/Notice/FacettesTypeDocTest.php +++ b/tests/library/ZendAfi/View/Helper/Notice/FacettesTypeDocTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Notice_FacettesTypeDocTest extends ViewHelperTestCase { @@ -26,29 +26,22 @@ class ZendAfi_View_Helper_Notice_FacettesTypeDocTest extends ViewHelperTestCase parent::setUp(); $this->_helper = new ZendAfi_View_Helper_Notice_FacettesTypeDoc(); $this->_helper->setView(new ZendAfi_Controller_Action_Helper_View()); - $this->_html = $this->_helper->notice_FacettesTypeDoc(['T' => [ 'titre' => 'Type de document', - 1 => ['id' => 'T1', - 'libelle' => 'Livres', - 'nombre' => 22], - 2 => ['id' => 'T3', - 'libelle' => 'DVD', - 'nombre' => 34]]]); + $this->_html = $this->_helper->notice_FacettesTypeDoc(['T' => ['T1' => 22, + 'T3' => 34]]); } /** @test */ public function linkForTypeDocLivreShouldContains22() { $this->assertXPathContentContains($this->_html, - '//div[@class="facettes_type_doc"]//a[@class="type_doc_1"][contains(@href, "facette/T1")]', - '22'); + '//div[@class="facettes_type_doc"]//a[@class="type_doc_1"][contains(@href, "facette/T1")]', '22'); } /** @test */ public function linkForTypeDVDShouldContains34() { $this->assertXPathContentContains($this->_html, - '//div[@class="facettes_type_doc"]//a[@class="type_doc_3"][contains(@href, "facette/T3")]', - '34'); + '//div[@class="facettes_type_doc"]//a[@class="type_doc_3"][contains(@href, "facette/T3")]', '34'); } } ?> \ No newline at end of file