diff --git a/VERSIONS_HOTLINE/205425 b/VERSIONS_HOTLINE/205425 new file mode 100644 index 0000000000000000000000000000000000000000..078354002386702cbb53e1fe1b7a927af493622b --- /dev/null +++ b/VERSIONS_HOTLINE/205425 @@ -0,0 +1 @@ + - correctif #205425 : Notice Opac [MT] : Les informations du champ 856 (u pour l'url et 2 ou y pour le label) sont utilisées pour afficher les liens avec un texte cliquable dans la description de la notice. \ No newline at end of file diff --git a/library/Class/Notice/Urls.php b/library/Class/Notice/Urls.php index 1d4df5b863c4633e4563966e7338e2239d1f2457..265d7014cc462b4ac7263997bf08d5ab0cb5f148 100644 --- a/library/Class/Notice/Urls.php +++ b/library/Class/Notice/Urls.php @@ -26,6 +26,8 @@ class Class_Notice_Urls { $_black_list, $_url_site; + const UNIMARC_ZONES_LINKS_DESCRIPTION = '856-u-2;856-u-a;856-u-y'; + public function __construct(Class_Notice $notice) { $this->_notice = $notice; @@ -51,7 +53,9 @@ class Class_Notice_Urls { $links_zones = Class_Profil::getCurrentProfil() ->getCfgModulesPreferences('recherche', 'viewnotice', - $this->_notice->getTypeDoc())['links_zones']; + $this->_notice->getTypeDoc())['links_zones'] + ?: static::UNIMARC_ZONES_LINKS_DESCRIPTION; + if (!$links_zones) return $this; diff --git a/library/Class/WebService/Amazon.php b/library/Class/WebService/Amazon.php index 9cf0a1159e7f077e415da830ced8db6d2c361131..9be55163a831d5366ef6fa6e4106edb6ef5747f9 100644 --- a/library/Class/WebService/Amazon.php +++ b/library/Class/WebService/Amazon.php @@ -105,7 +105,7 @@ class Class_WebService_Amazon { ? $notice->getIsbn() : $notice; - if (!trim($isbn)) + if (!trim($isbn ?? '')) return Class_Notice_ReviewsSet::emptyInstance(); if ($page > 0) diff --git a/tests/scenarios/Templates/TemplatesRecordsWithUrlsTest.php b/tests/scenarios/Templates/TemplatesRecordsWithUrlsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..19a68de13290d53362a1d006d92ccba78216d25d --- /dev/null +++ b/tests/scenarios/Templates/TemplatesRecordsWithUrlsTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright (c) 2012-2024, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * 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 + */ + + + + + + +class TemplatesRecordsWithUrlsWithTextReplacementTest + extends AbstractControllerTestCase +{ + + public function setUp(): void + { + parent::setUp(); + + $this->_buildTemplateProfil(['id' => 34, + 'template' => 'Intonation']); + + $this->fixture(Class_CodifLangue::class, + ['id' => 'fre', 'libelle' => 'Français']); + + $notice_unimarc = (new Class_NoticeUnimarc_Fluent) + ->zoneWithChildren('200', ['a' => 'Art Brut', 'f' => 'Christophe Arleston']) + ->zoneWithChildren('225', ['a' => 'Trolls de Troy', + 'v' => '23']) + ->zoneWithChildren('856', ['u' => 'https://monsiteweb.fr', + '2' => 'Cliquez moi pour aller sur monsite.fr']) + ->zoneWithChildren('856', ['u' => 'https://autresite.fr', + 'y' => 'Follow me']) + ; + + $this->fixture(Class_Notice::class, + ['id' => 2, + 'type_doc' => Class_TypeDoc::LIVRE, + 'annee' => '2018', + 'unimarc' => $notice_unimarc->render()]); + + $this->dispatch('/opac/recherche/viewnotice/id/2/profile_id/34'); + } + + + /** @test */ + public function pageShouldContainsUrlMonSiteWebDotFrWithCliquezMoiAsText() + { + $this->assertXPathContentContains('//div[contains(@class, "jumbotron_section_content")]//dt[contains(@class,"liens internet")]/following-sibling::dd//a[@href="https://monsiteweb.fr"]', + 'Cliquez moi pour aller sur', + $this->_response->getBody()); + } + + + /** @test */ + public function pageShouldContainsUrlAutreSiteDotFrWithFollowMeAsText() + { + $this->assertXPathContentContains('//div[contains(@class, "jumbotron_section_content")]//dt[contains(@class,"liens internet")]/following-sibling::dd//a[@href="https://autresite.fr"]', + 'Follow me'); + } +}