Commit c2248df4 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #50082 fix fatal error

parent 04af42c2
Pipeline #279 failed with stage
in 8 minutes
......@@ -441,7 +441,6 @@ class AbonneController extends ZendAfi_Controller_Action {
if ($delete = $this->_getParam('consultation_id_delete'))
Class_CommSigb::getInstance()->onPlaceConsultationCancelBooking(Class_Users::getIdentity(), $delete);
$this->view->reservations = $this->_user->getReservations();
$this->view->consultations_reservations = $this->_user->getConsultations();
$this->view->fiche = $this->_user->getFicheSigb();
$this->view->user = $this->_user;
......
......@@ -600,12 +600,11 @@ class RechercheController extends ZendAfi_Controller_Action {
}
}
return ($current_hold
&& ($location_label = $current_hold->getPickupLocationLabel())) ?
$this->view->_('Votre réservation est enregistrée.<br>Nous vous informerons quand le document%s sera disponible pour être retiré à : %s',
$this->_getMessageNoticeLabel($item_id), $location_label) :
$this->view->_('Votre réservation est enregistrée.<br>Nous vous informerons quand le document%s sera disponible',
$this->_getMessageNoticeLabel($item_id));
return ($current_hold && ($location_label = $current_hold->getPickupLocationLabel()))
? $this->view->_('Votre réservation est enregistrée.<br>Nous vous informerons quand le document%s sera disponible pour être retiré à : %s',
$this->_getMessageNoticeLabel($item_id), $location_label)
: $this->view->_('Votre réservation est enregistrée.<br>Nous vous informerons quand le document%s sera disponible',
$this->_getMessageNoticeLabel($item_id));
}
......
......@@ -21,12 +21,20 @@
class Class_ExemplaireLoader extends Storm_Model_Loader {
public function findFirstBySIGBOperation($user, $operation) {
if(!$user || !$operation)
return null;
$params = $operation->getCodeBarre()
? ['code_barres' => $operation->getCodeBarre()]
: ['id_origine' => $operation->getNoNotice()];
if (!array_filter($params))
return null;
$int_bibs = Class_IntBib::findAllAvailableForUser($user);
if($int_bibs->isEmpty())
return null;
$params['id_int_bib'] = $int_bibs->collect('id')->getArrayCopy();
if (!array_filter($params))
......@@ -37,6 +45,8 @@ class Class_ExemplaireLoader extends Storm_Model_Loader {
}
class Class_Exemplaire extends Storm_Model_Abstract {
use Trait_Translator, Trait_TimeSource;
......
......@@ -33,9 +33,9 @@ class IntBibLoader extends Storm_Model_Loader {
public function findAllAvailableForUser($user) {
return $user_int_bib = $user->getIntBib()
? $user_int_bib->findAllWithSameCommunication()
: [];
if($user_int_bib = $user->getIntBib())
return $user_int_bib->findAllWithSameCommunication();
new Storm_Collection();
}
}
......@@ -118,7 +118,7 @@ class Class_IntBib extends Storm_Model_Abstract {
public function findAllWithSameCommunication() {
return (new Storm_Model_Collection(Class_IntBib::findAll()))
return (new Storm_Model_Collection($this->getLoader()->findAll()))
->select([$this, 'hasSameCommunicationAs']);
}
......
......@@ -427,7 +427,7 @@ class Class_WebService_SIGB_Emprunteur {
}
public function getEmprunts(){
public function getEmprunts() {
if (null !== $this->_emprunts)
return $this->_emprunts;
......
......@@ -135,9 +135,9 @@ class Class_WebService_SIGB_Exemplaire {
public function getTitre() {
return ($record = $this->getNoticeOPAC())
&& ($record_title = $record->getTitrePrincipal())
? $record_title : $this->titre;
return $this->_notice_opac
? $this->_notice_opac->getTitrePrincipal()
: $this->titre;
}
......@@ -173,10 +173,9 @@ class Class_WebService_SIGB_Exemplaire {
public function getAuteur(){
if (!$this->auteur and ($notice = $this->getNoticeOPAC()))
$this->auteur = $notice->getAuteurPrincipal();
return $this->auteur;
$this->_notice_opac
? $this->_notice_opac->getAuteurPrincipal()
: $this->auteur;
}
......
......@@ -68,7 +68,8 @@ class Class_WebService_SIGB_Koha_PatronInfoReader extends Class_WebService_SIGB_
public function endHoldingbranch($data) {
if ($this->_currentLoan) $this->updateBibliothequeWith($data);
if ($this->_currentLoan)
$this->updateBibliothequeWith($data);
}
......
......@@ -359,6 +359,8 @@ class RechercheControllerReservationWithWebServiceKohaTest extends AbstractContr
public function setUp() {
parent::setUp();
$webservice = 'http://bib.valensol.net';
$this->jajm = $this->fixture('Class_Users',
['id' => 1,
'login' => 'jajm',
......@@ -366,15 +368,19 @@ class RechercheControllerReservationWithWebServiceKohaTest extends AbstractContr
'int_bib' => $this->fixture('Class_IntBib',
['id' => 1,
'comm_sigb' => Class_IntBib::COM_KOHA,
'comm_params' => ['url_serveur' => 'http://bib.valensol.net']])
'comm_params' => ['url_serveur' => $webservice]])
]);
ZendAfi_Auth::getInstance()->logUser($this->jajm);
$this->koha = Storm_Test_ObjectWrapper::mock();
$this->koha
->whenCalled('getServerRoot')
->answers($webservice);
Class_WebService_SIGB_Koha::setService(['url_serveur' => 'http://bib.valensol.net',
'id_bib' => 1,
'type' => Class_IntBib::COM_KOHA],
$this->koha = Storm_Test_ObjectWrapper::mock());
Class_WebService_SIGB_Koha::setService(['url_serveur' => $webservice,
'id_bib' => 1,
'type' => Class_IntBib::COM_KOHA],
$this->koha);
}
......
Markdown is supported
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