diff --git a/library/Class/WebService/SIGB/BiblixNet/PatronInfoReader.php b/library/Class/WebService/SIGB/BiblixNet/PatronInfoReader.php index ec4fabaa3a4f4a31a7b7ac067f6273f1f873c22a..62c5c997fc2d27c1357bc3223768e5a5a2d47e07 100644 --- a/library/Class/WebService/SIGB/BiblixNet/PatronInfoReader.php +++ b/library/Class/WebService/SIGB/BiblixNet/PatronInfoReader.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_WebService_SIGB_BiblixNet_PatronInfoReader extends Class_WebService_SIGB_AbstractILSDIPatronInfoReader{ @@ -77,6 +77,9 @@ class Class_WebService_SIGB_BiblixNet_PatronInfoReader extends Class_WebService_ public function endState($data) { $this->_currentHold->setEtat($data); + if (trim($data)=='Disponible') + $this->_currentHold->setWaitingToBePulled(); + } } diff --git a/library/Class/WebService/SIGB/Dynix/LookupMyAccountInfoResponseReader.php b/library/Class/WebService/SIGB/Dynix/LookupMyAccountInfoResponseReader.php index 476688e1c328cadce7de4f10ac320e6308fcab9d..d4fadd288092e1d788eff4191166de0d3235b74c 100644 --- a/library/Class/WebService/SIGB/Dynix/LookupMyAccountInfoResponseReader.php +++ b/library/Class/WebService/SIGB/Dynix/LookupMyAccountInfoResponseReader.php @@ -94,7 +94,13 @@ class Class_WebService_SIGB_Dynix_LookupMyAccountInfoResponseReader { public function endAvailable($data) { - $this->_current_operation->setEtat($data == 'true' ? $this->_('Disponible') : $this->_('Réservé')); + if ($data == 'true') { + $this->_current_operation->setEtat($this->_('Disponible')); + $this->_current_operation->setWaitingToBePulled(); + } + else { + $this->_current_operation->setEtat($this->_('Réservé')); + } } diff --git a/library/Class/WebService/SIGB/Microbib/InfosAbonneResponseReader.php b/library/Class/WebService/SIGB/Microbib/InfosAbonneResponseReader.php index 84912f88a38d05a500641478303a1684dfad25ca..38e9b6f3e46c89c6ef03b2fdcb4722a1aa792c34 100644 --- a/library/Class/WebService/SIGB/Microbib/InfosAbonneResponseReader.php +++ b/library/Class/WebService/SIGB/Microbib/InfosAbonneResponseReader.php @@ -109,7 +109,12 @@ class Class_WebService_SIGB_Microbib_InfosAbonneResponseReader { public function endDisponible($data) { - $this->_current_operation->setEtat($data == 'true' ? 'Disponible' : 'Réservé'); + if ($data == 'true') { + $this->_current_operation->setEtat('Disponible'); + $this->_current_operation->setWaitingToBePulled(); + return; + } + $this->_current_operation->setEtat('Réservé'); } } diff --git a/library/Class/WebService/SIGB/Orphee/GetLstRsvResponseReader.php b/library/Class/WebService/SIGB/Orphee/GetLstRsvResponseReader.php index 726630a6cb6f5c1712dd0fb1e2d9c2d602918e4a..b5a44dd26d5be47584c3b8cd4d5c9324fec23455 100644 --- a/library/Class/WebService/SIGB/Orphee/GetLstRsvResponseReader.php +++ b/library/Class/WebService/SIGB/Orphee/GetLstRsvResponseReader.php @@ -85,13 +85,20 @@ class Class_WebService_SIGB_Orphee_GetLstRsvResponseReader extends Class_WebServ public function endSit($data) { - $this->_current_reservation->setEtat(trim($data)); + $status = trim($data); + if (!is_numeric($status)) {//compatibility with Orphée WS version < version K + $this->_current_reservation->setEtat($status); + } - if (trim($data) != 'en attente') + if ($status == 'affectée' || $status == '2') $this->_current_reservation->setWaitingToBePulled(); } + public function endLib_Sit($data) { + $this->_current_reservation->setEtat(trim($data)); + } + public function endRang($data) { $this->_current_reservation->setRang(trim($data)); } diff --git a/library/Class/WebService/SIGB/Pergame/Service.php b/library/Class/WebService/SIGB/Pergame/Service.php index a7a3887ee5a540afaeaee0be200e5ce7809ce280..490f2c1d417fa3697ce363f64c04a646579ae7a6 100644 --- a/library/Class/WebService/SIGB/Pergame/Service.php +++ b/library/Class/WebService/SIGB/Pergame/Service.php @@ -98,12 +98,18 @@ class Class_WebService_SIGB_Pergame_Service extends Class_WebService_SIGB_Abstra $reservations = []; foreach($reservations_db as $reservation) { $bib = Class_Bib::find($reservation->getIdSite()); - $reservations []= Class_WebService_SIGB_Reservation::newInstanceWithEmptyExemplaire() + + $sigb_reservation = Class_WebService_SIGB_Reservation::newInstanceWithEmptyExemplaire() ->setId($reservation->getId()) ->setNoticeOPAC($reservation->getNotice()) ->setBibliotheque($bib ? $bib->getLibelle() : '') ->setRang($reservation->getDynamicRank()) ->setEtat($reservation->getEtat()); + + if ($sigb_reservation->getEtat() === 'Disponible') + $sigb_reservation->setWaitingToBePulled(); + + $reservations []= $sigb_reservation; } return $reservations; diff --git a/tests/library/Class/WebService/SIGB/BiblixNetTest.php b/tests/library/Class/WebService/SIGB/BiblixNetTest.php index 17a8007aab2f96326057da472ef1e70ec5eb6603..145b137db9fa1ef2bcd4ef4be325f52d6acf8bbc 100644 --- a/tests/library/Class/WebService/SIGB/BiblixNetTest.php +++ b/tests/library/Class/WebService/SIGB/BiblixNetTest.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once('BiblixNetFixtures.php'); @@ -70,7 +70,7 @@ abstract class BiblixNetTestCase extends Storm_Test_ModelTestCase { class BiblixNetGetRecordsLaCenseAuxAlouettesTest extends BiblixNetTestCase { public function setUp() { parent::setUp(); - + $this->_mock_web_client ->whenCalled('open_url') ->with('http://mediathequewormhout.biblixnet.com/exporte_afi/?service=GetRecords&id=3') @@ -154,7 +154,7 @@ class BiblixNetGetRecordsLaCenseAuxAlouettesTest extends BiblixNetTestCase { class BiblixNetGetPatronInfoJustinTicou extends BiblixNetTestCase { public function setUp() { parent::setUp(); - + $this->_mock_web_client ->whenCalled('open_url') ->with('http://mediathequewormhout.biblixnet.com/exporte_afi/?service=GetPatronInfo&patronId=34&showLoans=1&showHolds=1') @@ -257,10 +257,22 @@ class BiblixNetGetPatronInfoJustinTicou extends BiblixNetTestCase { } + /** @test */ + public function firstHoldWaitingToBePulledShouldBeFalse() { + $this->assertFalse($this->_emprunteur->getReservations()[0]->isWaitingToBePulled()); + } + + /** @test */ public function secondHoldEtatShouldBeDisponible() { $this->assertEquals('Disponible', $this->_emprunteur->getReservations()[1]->getEtat()); } + + + /** @test */ + public function secondHoldWaitingToBePulledShouldBeTrue() { + $this->assertTrue($this->_emprunteur->getReservations()[1]->isWaitingToBePulled()); + } } @@ -284,7 +296,7 @@ class BiblixNetOperationsTest extends BiblixNetTestCase { )); } - + /** @test */ public function reserverExemplairesWithErrorShouldReturnErrorWithMessage() { $this->_mock_web_client @@ -348,7 +360,7 @@ class BiblixNetOperationsTest extends BiblixNetTestCase { $this->_service->prolongerPret( Class_Users::getLoader()->newInstance()->setIdSigb('4'), '987' - )); + )); } @@ -364,9 +376,9 @@ class BiblixNetOperationsTest extends BiblixNetTestCase { $this->_service->prolongerPret( Class_Users::getLoader()->newInstance()->setIdSigb('4'), '987' - )); + )); } - + } diff --git a/tests/library/Class/WebService/SIGB/DynixTest.php b/tests/library/Class/WebService/SIGB/DynixTest.php index 730dccffc2fdaf36e1232a34e96035f2f32d1dec..631263faa53f8ebffa25c009a9f8bb3164956b7e 100644 --- a/tests/library/Class/WebService/SIGB/DynixTest.php +++ b/tests/library/Class/WebService/SIGB/DynixTest.php @@ -375,6 +375,12 @@ class DynixGetEmprunteurManuLarcinetTest extends DynixTestCase { } + /** @test */ + public function nbOfHoldWaitingToBePulledShouldBeOne() { + $this->assertCount(1, $this->_manu->getHoldsWaitingToBePulled()); + } + + /** @test */ public function sessionShouldBeClosed() { $this->assertTrue($this->_mock_web_client diff --git a/tests/library/Class/WebService/SIGB/MicrobibServiceTest.php b/tests/library/Class/WebService/SIGB/MicrobibServiceTest.php index c44b2a0c59132f77df03d5f4b67d937ba8612c93..34664dcd857ba6fdd2490c6c60991d88ce0e7772 100644 --- a/tests/library/Class/WebService/SIGB/MicrobibServiceTest.php +++ b/tests/library/Class/WebService/SIGB/MicrobibServiceTest.php @@ -243,6 +243,12 @@ class MicrobibServiceTestInfosAbonne extends MicrobibServiceTestCase { } + /** @test */ + public function nbOfHoldsWaitingToBePulledShouldBeOne() { + $this->assertCount(1, $this->emprunteur->getHoldsWaitingToBePulled()); + } + + /** @test */ public function firstReservationAuteurShouldBeBIGART() { $this->assertEquals('BIGART T.P.', array_first($this->emprunteur->getReservations())->getAuteur()); diff --git a/tests/library/Class/WebService/SIGB/OrpheeFixtures.php b/tests/library/Class/WebService/SIGB/OrpheeFixtures.php index 4015b314c734cd7a766de39f38d6d23b06711213..ea379cc400719c2bbef88019663b0b464ce3345a 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeFixtures.php +++ b/tests/library/Class/WebService/SIGB/OrpheeFixtures.php @@ -395,7 +395,8 @@ renouvellement --> <tit><![CDATA[Le singe bleu]]></tit> <auteur><![CDATA[Steinbeck, John (1902-1968)]]></auteur> <editeur><![CDATA[Gallimard]]></editeur> - <sit><![CDATA[????????]]></sit> + <lib_sit><![CDATA[affectée]]></lib_sit> + <sit><![CDATA[2]]></sit> <date_crea><![CDATA[09/06/2008]]></date_crea> <date_fin></date_fin> <rang>1</rang> diff --git a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php index 9ed3999e537c917eb4c0c6f167a4fc3c3e53d495..5949ab70c05b92dba4de46a716d15608bf04b591 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php +++ b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php @@ -730,7 +730,6 @@ class OrpheeServiceGetInfoUserCarteHenryDupontTest extends OrpheeServiceTestCase $this->assertNotEmpty($this->emprunteur); } - /** @test */ public function nbOfHoldsWaitingToBePulledShouldBeOne() { $this->assertCount(1, $this->emprunteur->getHoldsWaitingToBePulled()); @@ -984,6 +983,12 @@ class OrpheeServiceGetInfoUserCarteHenryDupontTest extends OrpheeServiceTestCase } + /** @test */ + public function fourthHoldGetEtatShouldReturnAffectee() { + $this->assertEquals('affectée', $this->emprunteur->getReservations()[3]->getEtat()); + } + + /** * @test * @depends firstReservationShouldNotBeEmpty diff --git a/tests/library/Class/WebService/SIGB/PergameTest.php b/tests/library/Class/WebService/SIGB/PergameTest.php index 8bfd7ce03445ea859ed5a52ca3b464b4fe2e4780..2361b033021dd80a6b6e73b4ae390e869d463b7c 100644 --- a/tests/library/Class/WebService/SIGB/PergameTest.php +++ b/tests/library/Class/WebService/SIGB/PergameTest.php @@ -229,6 +229,24 @@ class PergameServiceGetEmprunteurTest extends PergameTestCase { } + /** @test */ + public function firstReservationWaitingToBePulledShouldBeFalse() { + $this->assertFalse($this->_first_reservation->isWaitingToBePulled()); + } + + /** @test */ + public function secondReservationEtatShouldBeDisponible() { + $this->assertEquals('Disponible', + $this->emprunteur_jc->getReservations()[1]->getEtat()); + } + + + /** @test */ + public function secondReservationWaitingToBePulledShouldBeTrue() { + $this->assertTrue($this->emprunteur_jc->getReservations()[1]->isWaitingToBePulled()); + } + + /** @test */ public function firstReservationBibliothequeShouldBeCranGevrier() { $this->assertEquals('Cran-Gevrier', $this->_first_reservation->getBibliotheque()); diff --git a/tests/library/Class/WebService/SIGB/VSmartTest.php b/tests/library/Class/WebService/SIGB/VSmartTest.php index a3e981e9c1d3accd7ceb2c597309b634e034bb61..f506f72251793398b8cf85eec22bb1aacc932c49 100644 --- a/tests/library/Class/WebService/SIGB/VSmartTest.php +++ b/tests/library/Class/WebService/SIGB/VSmartTest.php @@ -58,6 +58,7 @@ class VSmartServiceDummyFunctionsTest extends Storm_Test_ModelTestCase { } + class VSmartGetServiceTest extends Storm_Test_ModelTestCase { public function setUp() { Class_WebService_SIGB_VSmart::reset();