From 691adeae8d7b9064a8fffe86c8bf804f148cd469 Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@git-test.afi-sa.fr> Date: Fri, 13 Apr 2012 12:34:04 +0000 Subject: [PATCH] =?UTF-8?q?rel=20#4838,=20r=C3=A9application=20de=20la=20r?= =?UTF-8?q?=C3=A9vision=20r1426=20suite=20publication=20version=20CE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/Class/CommSigb.php | 14 ++++++------- library/Class/WebService/SIGB/Exemplaire.php | 20 +++++++++++++++++++ .../SIGB/Nanook/GetRecordsResponseReader.php | 9 +++++++++ tests/library/Class/CommSigbTest.php | 3 ++- .../Class/WebService/SIGB/NanookFixtures.php | 1 + .../Class/WebService/SIGB/NanookTest.php | 15 ++++++++++---- 6 files changed, 50 insertions(+), 12 deletions(-) diff --git a/library/Class/CommSigb.php b/library/Class/CommSigb.php index d0b54ad4929..83c4da5c97b 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 70e81a1fe16..ef1cf240ce3 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 a75cb63b002..21e6d298ace 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 a56e49853b5..99e08279df2 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 7d7b43fdeec..41a50f694f2 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 bf79c392887..1a3ab04c2ad 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()); } -- GitLab