Skip to content
Snippets Groups Projects
Commit 1ca9533e authored by Laurent's avatar Laurent
Browse files

hotline #114558 Jumel connector : sso url not saved in database anymore

parent 4adc5dd5
Branches
Tags
3 merge requests!3679Hotline,!3678merge Hotline,!3654hotline #114558 Jumel connector : sso url not saved in database anymore
Pipeline #11195 passed with stage
in 53 minutes and 2 seconds
- 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
......@@ -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());
};
......
......@@ -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();
......
......@@ -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;
......
......@@ -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())
......
......@@ -61,6 +61,6 @@ class Intonation_Library_Record {
if (!$items = $this->getItemsFromSIGB())
return null;
return $items[0]->getUrl();
return $items[0]->getExternalUrl();
}
}
......@@ -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');
......
......@@ -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());
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment