Skip to content
Snippets Groups Projects
Commit 4b4c70e6 authored by lbrun's avatar lbrun
Browse files

pique_temp

parent 953fb919
Branches
Tags
7 merge requests!1553Master,!1502Master,!1501Stable,!1472Stable,!1409Stable,!1381Dev#35570 pique 74,!1377Dev#35570 pique 74
......@@ -48,16 +48,8 @@ class Class_CommSigb {
public function getDispoExemplaire($exemplaire) {
$exemplaire->setDispo($exemplaire->getIsAvailable()
? $this->_('Disponible')
: $this->_('Non disponible'));
$exemplaire->setReservable(false);
if ($exemplaire->isDisconnected() && $exemplaire->hasActivite()) {
$exemplaire->setDispo($exemplaire->getActivite());
return $exemplaire;
}
$sigb_exemplaire = $exemplaire->getSigbExemplaire();
if (!$sigb_exemplaire->isValid())
return $exemplaire;
......@@ -65,7 +57,6 @@ class Class_CommSigb {
if ($sigb_exemplaire->isPilonne() || !$sigb_exemplaire->isVisibleOPAC())
return null;
$exemplaire->setDispo($sigb_exemplaire->getDisponibilite());
$exemplaire->setDateRetour($sigb_exemplaire->getDateRetour());
$exemplaire->setReservable($sigb_exemplaire->isReservable());
$exemplaire->setIdExemplaire($sigb_exemplaire->getId());
......
......@@ -206,6 +206,20 @@ class Class_Exemplaire extends Storm_Model_Abstract {
return Class_CodifAnnexe::findFirstBy(['code' => $this->getAnnexe()]);
}
public function getDisponibilite() {
if ($sigb_exemplaire = $this->getSigbExemplaire())
return $sigb_exemplaire->getDisponibilite();
if ($this->isDisconnected() && $this->hasActivite())
return $this->getActivite();
return $this->getIsAvailable()
? $this->_('Disponible')
: $this->_('Non disponible');
}
public function isDisponible($cache_only = false) {
if ($this->getNotice()->isRessourceNumerique())
return true;
......
......@@ -154,7 +154,7 @@ class ZendAfi_View_Helper_Notice_Exemplaires_Dispo extends ZendAfi_View_Helper_N
public function renderContent($exemplaire) {
$class_dispo='';
$libelle = $exemplaire->getDispo();
$libelle = $exemplaire->getDisponibilite();
$class_dispo = ($libelle == Class_WebService_SIGB_Exemplaire::DISPO_LIBRE)
? 'disponible'
: '';
......@@ -202,10 +202,15 @@ class ZendAfi_View_Helper_Notice_Exemplaires_Cote extends ZendAfi_View_Helper_No
class ZendAfi_View_Helper_Notice_Exemplaires_DateRetour extends ZendAfi_View_Helper_Notice_ExemplairesTable {
public function getLibelle() {
return $this->_('Retour');
}
public function getContent($exemplaire) {
xdebug_break();
return $exemplaire->getDateRetour() ? $exemplaire->getDateRetour() : NULL;
}
......
......@@ -108,6 +108,7 @@ class NoticeAjaxControllerPergameItemLabelConfiguredTest
$cfg = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray();
$cfg['exemplaires']['grouper'] = 1;
$cfg['exemplaires']['en_pret'] = 'En pret';
$cfg['exemplaires']['date_retour'] = 1;
Class_Profil::getCurrentProfil()->setCfgNotice($cfg);
$this->dispatch('/noticeajax/exemplaires/id_notice/23', true);
......@@ -120,4 +121,35 @@ class NoticeAjaxControllerPergameItemLabelConfiguredTest
'En pret',
$this->_response->getBody());
}
/** @test */
public function returnDateShouldBe20150331() {
$this->assertXPathContentContains('//td[contains(@class, "date_retour")]',
'2015-03-31',
$this->_response->getBody());
}
}
class NoticeAjaxControllerPergameGroupedTest
extends NoticeAjaxControllerPergameItemTestCase {
public function setUp() {
parent::setUp();
$cfg = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray();
$cfg['exemplaires']['grouper'] = 0;
$cfg['exemplaires']['en_pret'] = 'Emprunter';
Class_Profil::getCurrentProfil()->setCfgNotice($cfg);
$this->dispatch('/noticeajax/exemplaires/id_notice/23', true);
}
/** @test */
public function availabilityLabelShouldBeEmprunter() {
$this->assertXPathContentContains('//td[contains(@class, "dispo")]',
'Emprunter',
$this->_response->getBody());
}
}
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