diff --git a/VERSIONS_HOTLINE/17262 b/VERSIONS_HOTLINE/17262 new file mode 100644 index 0000000000000000000000000000000000000000..78077f026faa8de9f05be40a3edc9c23a3c9d734 --- /dev/null +++ b/VERSIONS_HOTLINE/17262 @@ -0,0 +1 @@ +- ticket #17262: Rend possible l'utilisation de la même valeur pour les variables FACETTE_*_LIBELLE \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Notice/Entete.php b/library/ZendAfi/View/Helper/Notice/Entete.php index 55f03b7c897bfdb7675cfebf2323c3bfad0ded67..71824307f21a81928564fc468ab793c281dc5a53 100644 --- a/library/ZendAfi/View/Helper/Notice/Entete.php +++ b/library/ZendAfi/View/Helper/Notice/Entete.php @@ -56,27 +56,33 @@ class ZendAfi_View_Helper_Notice_Entete extends Zend_View_Helper_HtmlElement { } public function getValeurs($notice, $entetes) { - $values = []; - $facettes = $notice->getFacettes(); - array_walk( - $entetes, - function($item) use (&$values, $facettes, $notice) { - $label = Class_Codification::getInstance()->getNomChamp($item, 1); - $values[$label] = $notice->getChampNotice($item, $facettes); + $values = []; + $facettes = $notice->getFacettes(); + array_walk( + $entetes, + function($item) use (&$values, $facettes, $notice) { + $label = Class_Codification::getInstance()->getNomChamp($item, 1); + $champ_notice = $notice->getChampNotice($item, $facettes); + if ($champ_notice) { + $values[] = [ + 'label' => $label, + 'champ' => $champ_notice, + ]; + } }); - return array_filter($values); + return array_filter($values); } public function libellesValeursToHtmlAndSerie($libelles_valeurs,$notice){ $html = $this->addSeries($notice).'<dl>'; $i=0; - foreach($libelles_valeurs as $libelle => $valeur){ + foreach($libelles_valeurs as $item){ $class = is_odd($i) ? 'second' : 'first' ; $html.= - '<dt class="'.$class.' '.str_replace('é','e',strtolower(str_replace(['(',')'], '',$libelle))).'">'.$libelle.'</dt>'. - '<dd class="'.$class.'">'.$this->getValeurHtml($valeur).'</dd>'; + '<dt class="'.$class.' '.str_replace('é','e',strtolower(str_replace(['(',')'], '',$item['label']))).'">'.$item['label'].'</dt>'. + '<dd class="'.$class.'">'.$this->getValeurHtml($item['champ']).'</dd>'; $i++; } diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index 444d201894502f18afbec75994147b6ec497a886..31c072d018e2ab5fb94b460944c0b622c9c77faf 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -161,6 +161,8 @@ class RechercheControllerViewNoticeWithPreferencesTest extends RechercheControll Class_Notice::setTimeSource($time_source); Class_AdminVar::newInstanceWithId('FACETTE_GENRE_LIBELLE', ['valeur' => 'GENRES']); + Class_AdminVar::newInstanceWithId('FACETTE_DEWEY_LIBELLE', ['valeur' => 'Classification']); + Class_AdminVar::newInstanceWithId('FACETTE_PCDM4_LIBELLE', ['valeur' => 'Classification']); $this->notice->setClefChapeau('Gallimard serie'); $preferences = [ @@ -383,6 +385,14 @@ class RechercheControllerViewNoticeWithPreferencesTest extends RechercheControll public function barreNavShouldContainsCinemaAnimation() { $this->assertXPathContentContains('//div[@class="barre_nav"]//span', 'Cinéma d\'animation'); } + + /** @test */ + public function deweyAndPcdm4WithSameLibelleShouldBePresent() { + $this->assertXPathContentContains('//div[@class="entete_notice"]//dt[contains(@class, "classification")]', 'Classification'); + $this->assertXPathContentContains('//div[@class="entete_notice"]//dt[contains(@class, "classification")]/following::dd', 'Philosophie et disciplines connexes'); + $this->assertXPathContentContains('//div[@class="entete_notice"]//dt[contains(@class, "classification")]', 'Classification'); + $this->assertXPathContentContains('//div[@class="entete_notice"]//dt[contains(@class, "classification")]/following::dd', 'rock'); + } }