diff --git a/library/Class/CommSigb.php b/library/Class/CommSigb.php index d0b54ad4929a1c1325e62af8c8352c361f72bdc4..83c4da5c97b9bba1c7a69c844cef073df320d62d 100644 --- a/library/Class/CommSigb.php +++ b/library/Class/CommSigb.php @@ -63,13 +63,13 @@ class Class_CommSigb { * @return array */ public function getDispoExemplaires($exemplaires_to_check) { - $exemplaires = array(); - - foreach ($exemplaires_to_check as $exemplaire) { - $exemplaire["dispo"]="non connue"; - $exemplaire["reservable"]=false; - - $mode_comm=$this->getModeComm($exemplaire['id_bib']); + $exemplaires = array(); + + foreach ($exemplaires_to_check as $exemplaire) { + $exemplaire["dispo"] = "non connue"; + $exemplaire["reservable"]=false; + + $mode_comm=$this->getModeComm($exemplaire['id_bib']); if ($sigb = $this->getSIGBComm($mode_comm)) { $sigb_exemplaire = $sigb->getExemplaire($exemplaire["id_origine"], $exemplaire["code_barres"]); diff --git a/library/Class/WebService/SIGB/Exemplaire.php b/library/Class/WebService/SIGB/Exemplaire.php index 70e81a1fe16e162e13e05371eec3d577fcb59671..ef1cf240ce30a1e73d63e3928d85ff117806866a 100644 --- a/library/Class/WebService/SIGB/Exemplaire.php +++ b/library/Class/WebService/SIGB/Exemplaire.php @@ -45,6 +45,8 @@ class Class_WebService_SIGB_Exemplaire { protected $code_annexe; protected $_notice_opac; protected $_exemplaire_opac; + protected $_disponibiliteLabel; + protected $_isEnPret; public static function newInstance() { @@ -61,6 +63,8 @@ class Class_WebService_SIGB_Exemplaire { $this->auteur = ''; $this->code_barre = ''; $this->visible_opac = true; + $this->_disponibiliteLabel = null; + $this->_isEnPret = false; } @@ -231,12 +235,17 @@ class Class_WebService_SIGB_Exemplaire { * @return string */ public function getDisponibilite() { + if ($this->_isEnPret) + return $this->disponibilite; + if (null !== $this->_disponibiliteLabel) + return $this->_disponibiliteLabel; return $this->disponibilite; } public function setDisponibiliteEnPret() { $this->setDisponibilite($this->getLibelleDispoEnPret()); + $this->_isEnPret = true; return $this; } @@ -286,6 +295,17 @@ class Class_WebService_SIGB_Exemplaire { } + public function getDisponibiliteLabel() { + return $this->_disponibiliteLabel; + } + + + public function setDisponibiliteLabel($label) { + $this->_disponibiliteLabel = $label; + return $this; + } + + public function setReservable($reservable){ $this->reservable = ($reservable == "true"); return $this; diff --git a/library/Class/WebService/SIGB/Nanook/GetRecordsResponseReader.php b/library/Class/WebService/SIGB/Nanook/GetRecordsResponseReader.php index a75cb63b00245d0b97f1221d5cd76cc29c6eda24..21e6d298ace34eb6c9cccf94ae094e667916d242 100644 --- a/library/Class/WebService/SIGB/Nanook/GetRecordsResponseReader.php +++ b/library/Class/WebService/SIGB/Nanook/GetRecordsResponseReader.php @@ -135,5 +135,14 @@ class Class_WebService_SIGB_Nanook_GetRecordsResponseReader { public function endLocationId($data) { $this->_current_item->setCodeAnnexe((int)$data); } + + + /** + * @param string $data + */ + public function endActivityMessage($data) { + $this->_current_item->setDisponibiliteLabel($data); + } } + ?> \ No newline at end of file diff --git a/tests/library/Class/CommSigbTest.php b/tests/library/Class/CommSigbTest.php index a56e49853b52da5edca9c06f30841108d018d6c8..99e08279df2f9b43d92ba898e0f310ada6b368b3 100644 --- a/tests/library/Class/CommSigbTest.php +++ b/tests/library/Class/CommSigbTest.php @@ -78,6 +78,7 @@ abstract class CommSigbTestCase extends Storm_Test_ModelTestCase { $alice_merveilles = new Class_WebService_SIGB_Exemplaire('789'); $alice_merveilles ->setDisponibilite('Disponible') + ->setDisponibiliteLabel('Sur demande calligraphiee') ->setReservable(false) ->setCodeAnnexe(8) ->setDateRetour(''); @@ -121,7 +122,7 @@ abstract class CommSigbTestCase extends Storm_Test_ModelTestCase { 'code_barres' => 'ALM', 'id_bib' => 8, 'annexe' => 8, - 'dispo' => 'Disponible', + 'dispo' => 'Sur demande calligraphiee', 'reservable' => false, 'date_retour' => '', 'id_exemplaire' => '789'), diff --git a/tests/library/Class/WebService/SIGB/NanookFixtures.php b/tests/library/Class/WebService/SIGB/NanookFixtures.php index 7d7b43fdeecf949a0d7a6162ccf09f2bf2da50ec..41a50f694f271f2715534f19bdf33a9346361b75 100644 --- a/tests/library/Class/WebService/SIGB/NanookFixtures.php +++ b/tests/library/Class/WebService/SIGB/NanookFixtures.php @@ -91,6 +91,7 @@ class NanookFixtures { <visible>1</visible> <locationLabel>Annecy</locationLabel> <locationId>3</locationId> + <activityMessage>Se renseigner a l\'accueil</activityMessage> </item> <item> <barcode>L-072666</barcode> diff --git a/tests/library/Class/WebService/SIGB/NanookTest.php b/tests/library/Class/WebService/SIGB/NanookTest.php index bf79c3928872f118cc5e39832c2e6ee7e7bf21cf..1a3ab04c2adfeb7f65dd82c87f49cb7e361e0d4a 100644 --- a/tests/library/Class/WebService/SIGB/NanookTest.php +++ b/tests/library/Class/WebService/SIGB/NanookTest.php @@ -215,9 +215,16 @@ class NanookGetNoticeLiliGrisbiAndCoTest extends NanookTestCase { /** @test */ - public function firstExemplaireShouldBeAvailable() { - $this->assertEquals(Class_WebService_SIGB_Exemplaire::DISPO_LIBRE, - $this->_notice->exemplaireAt(0)->getDisponibilite()); + public function firstExemplaireDisponibiliteShouldBeSeRenseigner() { + $this->assertEquals('Se renseigner a l\'accueil', + $this->_notice->exemplaireAt(0)->getDisponibilite()); + } + + + /** @test */ + public function firstExemplaireDisponibiliteLabelShouldBeSeRenseigner() { + $this->assertEquals('Se renseigner a l\'accueil', + $this->_notice->exemplaireAt(0)->getDisponibiliteLabel()); } @@ -265,7 +272,7 @@ class NanookGetNoticeLiliGrisbiAndCoTest extends NanookTestCase { /** @test */ - public function secondExemplaireDateRetourShould12_01_2029() { + public function secondExemplaireDateRetourShouldBe12012029() { $this->assertEquals('12/01/2029', $this->_notice->exemplaireAt(1)->getDateRetour()); }