Skip to content
Snippets Groups Projects
Commit 673cd627 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch...

Merge branch 'dev#49634_bonus_2255_choix_du_site_de_retrait_precocher_site_abonne_et_non_site_document' into 'master'

Dev#49634 bonus 2255 choix du site de retrait precocher site abonne et non site document

See merge request !2033
parents 5a8fc642 5d506782
Branches
Tags
4 merge requests!2102#57574 : correction orthographe des jours de la semaine,!2080Sandbox detach zf from storm,!2061Master,!2033Dev#49634 bonus 2255 choix du site de retrait precocher site abonne et non site document
Pipeline #504 passed with stage
in 12 minutes and 55 seconds
- ticket #49634 : Réservation : Lorsque le choix du site de retrait est activé dans la configuration cosmogramme, le site de l'abonné est pré-coché dans la liste des sites de retrait
\ No newline at end of file
......@@ -80,13 +80,29 @@ class ZendAfi_View_Helper_Notice_ReservationLink extends ZendAfi_View_Helper_Bas
'id_int_bib' => $ex->getIdIntBib(),
'id_bib' => $ex->getIdBib(),
'copy_id' => $ex->getId(),
'code_annexe' => $ex->getCodeAnnexe()]);
'code_annexe' => $this->_getBranchCode($ex)]);
return $this->_tag('a', $this->_getHoldImage(), ['href' => $link,
'data-popup' => 'true']);
}
protected function _getBranchCode($item) {
$item_branch_code = $item->getCodeAnnexe();
if(!Class_CosmoVar::isSiteRetraitResaChoiceEnabled())
return $item_branch_code;
if(!$user = Class_Users::getIdentity())
return $item_branch_code;
if(!$branch_code = $user->getLibraryCode())
return $item_branch_code;
return $branch_code;
}
/** @return string */
protected function _getHoldImageUrl() {
return Class_Profil::getCurrentProfil()->getUrlImage(self::HOLD_IMG);
......
......@@ -2299,3 +2299,66 @@ class NoticeAjaxControllerRecountsTest extends AbstractControllerTestCase {
}
}
class NoticeAjaxControllerNanookSIGBWithHoldSiteEnabledTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$this->fixture('Class_CosmoVar',
['id' => 'site_retrait_resa',
'valeur' => 1]);
$this->fixture('Class_Bib',
['id' => 12,
'libelle' => 'Library']);
$this->fixture('Class_IntBib',
['id' => 12,
'comm_sigb' => Class_IntBib::COM_NANOOK,
'comm_params' => ['url_serveur' => 'https://mynanook.org']]);
$item_from_sigb = (new Class_Entity())
->whenCalledDo('isValid', function() {return true;})
->whenCalledDo('isReservable', function() {return true;})
->whenCalledDo('isDisponible', function() {return false;})
;
$item = $this->fixture('Class_Exemplaire',
['id' => 654,
'cote' => '',
'annexe' => 'POL',
'id_bib' => 12,
'id_int_bib' => 12]);
$item->setSigbExemplaire($item_from_sigb);
$this->fixture('Class_Notice',
['id' => 10,
'exemplaires' => [$item]]);
$user_from_sigb = (new Class_Entity())
->whenCalledDo('getLibraryCode', function() {return 'CAV';})
;
$user = $this->fixture('Class_Users',
['id' => 789,
'login' => 'Paul',
'password' => 'passsss'])
->beAbonneSIGB()
->setFicheSIGB(['fiche' => $user_from_sigb]);
ZendAfi_Auth::getInstance()->logUser($user);
$this->dispatch('/noticeajax/exemplaires/id_notice/10', true);
}
/** @test */
public function holdLinkShouldContainsPaulBranchCode() {
$this->assertXPath('//table//a[@href="/recherche/reservation-pickup-ajax/id_notice/10/id_int_bib/12/id_bib/12/copy_id/654/code_annexe/CAV"]', $this->_response->getBody());
}
}
\ No newline at end of file
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