diff --git a/VERSIONS_HOTLINE/114558 b/VERSIONS_HOTLINE/114558 new file mode 100644 index 0000000000000000000000000000000000000000..3adf08e5dd5b3f3bfa5751576e02ae451e0acf0a --- /dev/null +++ b/VERSIONS_HOTLINE/114558 @@ -0,0 +1 @@ + - ticket #114558 : Magasin de thèmes - ressources Jumel : correction de l'affichage du lien erroné "consulter le document" en résultat de recherche \ No newline at end of file diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index 0b34514b8fadfbab08ce96ac66cd78fdd253c72c..33f43795dd485998804b3b7edbe6ec7f90516e90 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -554,7 +554,7 @@ class NoticeAjaxController extends ZendAfi_Controller_Action { $first_item = $this->notice->getExemplaires()[0]; $callback = function() use ($first_item) { - return $this->_getLinkOnline($first_item->getUrl()); + return $this->_getLinkOnline($first_item->getExternalUrl()); }; diff --git a/library/Class/Exemplaire.php b/library/Class/Exemplaire.php index 2355d5b759747e23c5a85a873d41fc1c40d0bfcd..8d4a17ae3f103764c5de4a908865843c130763d2 100644 --- a/library/Class/Exemplaire.php +++ b/library/Class/Exemplaire.php @@ -70,6 +70,7 @@ class Class_Exemplaire extends Storm_Model_Abstract { $_loader_class = 'Class_ExemplaireLoader', $_group_count = 0, $_fields, + $_url_for_current_user, $_belongs_to = [ 'notice' => ['model' => 'Class_Notice', 'referenced_in' => 'id_notice'], @@ -264,6 +265,19 @@ class Class_Exemplaire extends Storm_Model_Abstract { } + public function setUrlForCurrentUser($url) { + $this->_url_for_current_user = $url; + return $this; + } + + + public function getExternalUrl() { + return $this->_url_for_current_user + ? $this->_url_for_current_user + : $this->getUrl(); + } + + protected function _getBranchCode() { $item_branch_code = $this->getCodeAnnexe(); diff --git a/library/Class/WebService/SIGB/CdScript/Service.php b/library/Class/WebService/SIGB/CdScript/Service.php index 3ca3264771c19505ccc4eb1b211816c8e029d24c..6294b93fe4d4724f8c778992bc9a28a03d2612da 100644 --- a/library/Class/WebService/SIGB/CdScript/Service.php +++ b/library/Class/WebService/SIGB/CdScript/Service.php @@ -96,7 +96,7 @@ class Class_Webservice_SIGB_CdScript_Service extends Class_WebService_SIGB_Abstr if($item = $this->_getItem($id)) { $sigb_item->setCodeBarre($id); $sigb_item->setBibliotheque($item->getBib()); - $item->setUrl($this->getRessourceUrl($item))->save(); + $item->setUrlForCurrentUser($this->getRessourceUrl($item)); } $sigb_record->addExemplaire($sigb_item); return $sigb_record; diff --git a/library/ZendAfi/View/Helper/Notice/ExemplairesTable.php b/library/ZendAfi/View/Helper/Notice/ExemplairesTable.php index 5e5fcec5dcf216c0da46e3c9b73b6ede9c7de837..80ed9749e4e682fb8c39ee25500a96988c4d76e9 100644 --- a/library/ZendAfi/View/Helper/Notice/ExemplairesTable.php +++ b/library/ZendAfi/View/Helper/Notice/ExemplairesTable.php @@ -271,8 +271,8 @@ class ZendAfi_View_Helper_Notice_Exemplaires_Dispo extends ZendAfi_View_Helper_N protected function _getAvailabilityLabel($exemplaire) { - if ($exemplaire->getUrl()) - return $this->view->tagAnchor($exemplaire->getUrl(), + if ($exemplaire->getExternalUrl()) + return $this->view->tagAnchor($exemplaire->getExternalUrl(), $this->view->_('Description en ligne')); if ((new Class_Notice_Sso($exemplaire->getNotice()))->isValid()) diff --git a/library/templates/Intonation/Library/Record.php b/library/templates/Intonation/Library/Record.php index 0809f6f0f1e54dbf7f4477931b00f112c429747c..4ec19c1fa8ce952bd4f36b599e467e89346fcc23 100644 --- a/library/templates/Intonation/Library/Record.php +++ b/library/templates/Intonation/Library/Record.php @@ -61,6 +61,6 @@ class Intonation_Library_Record { if (!$items = $this->getItemsFromSIGB()) return null; - return $items[0]->getUrl(); + return $items[0]->getExternalUrl(); } } diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php index 374266034416c927fed3bc12733d7272711d880b..80110eca315aa2c2af7344f9bf3d9b643f3d39aa 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php @@ -136,21 +136,22 @@ class NoticeAjaxControllerCdScriptRecordWithoutLoginTest extends NoticeAjaxContr + class NoticeAjaxControllerCdScriptRecordAsPaulTest extends NoticeAjaxControllerCdScriptRecordTestCase { public function setUp() { parent::setUp(); $paul = $this->fixture('Class_Users', - ['id' => 15, - 'login' => 'paul', - 'nom' => 'Le Pollux', - 'prenom' => 'Paul', - 'id_sigb' => '654987', - 'idabon' => '23901000323008', - 'mail' => 'anemail@web.com', - 'naissance' => '2002-12-14', - 'password' => 'pollux', - 'date_fin' => '2015-12-14']); + ['id' => 15, + 'login' => 'paul', + 'nom' => 'Le Pollux', + 'prenom' => 'Paul', + 'id_sigb' => '654987', + 'idabon' => '23901000323008', + 'mail' => 'anemail@web.com', + 'naissance' => '2002-12-14', + 'password' => 'pollux', + 'date_fin' => '2015-12-14']); ZendAfi_Auth::getInstance()->logUser($paul); @@ -166,6 +167,12 @@ class NoticeAjaxControllerCdScriptRecordAsPaulTest extends NoticeAjaxControllerC } + /** @test */ + public function itemLeKiosqueShouldNotHaveURLSavedInDatabase() { + $this->assertEmpty(Class_Exemplaire::find(1)->getUrl()); + } + + /** @test */ public function libraryLabelShouldBeLeKiosqueLibrary() { $this->assertXPathContentContains('//table//td', 'Le kiosque library'); diff --git a/tests/library/Class/WebService/SIGB/CdScriptTest.php b/tests/library/Class/WebService/SIGB/CdScriptTest.php index ba940d8ecda1c91c73c9ce8038119c4adfc6303a..3b81aa90255179828df5cdd300b981213cf35393 100644 --- a/tests/library/Class/WebService/SIGB/CdScriptTest.php +++ b/tests/library/Class/WebService/SIGB/CdScriptTest.php @@ -104,9 +104,9 @@ class CdScriptServiceTest extends CdScriptTestCase { /** @test */ - public function leKiosqueItemUrlShouldBeJumelLink() { + public function leKiosqueItemExternalUrlShouldBeJumelLink() { $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=23901000323008:Le Pollux:Paul:2002-12-14:anemail@web.com:2015-12-14', - $this->_le_kiosque->getUrl()); + $this->_le_kiosque->getExternalUrl()); }