diff --git a/library/Class/WebService/SIGB/BiblixNet/PatronInfoReader.php b/library/Class/WebService/SIGB/BiblixNet/PatronInfoReader.php index 37d06e5359fa27bec41fc7e839d14189138d33b6..3f0db7d5c57110585109740e0d4f284ae3a37ee3 100644 --- a/library/Class/WebService/SIGB/BiblixNet/PatronInfoReader.php +++ b/library/Class/WebService/SIGB/BiblixNet/PatronInfoReader.php @@ -42,6 +42,9 @@ class Class_WebService_SIGB_BiblixNet_PatronInfoReader extends Class_WebService_ public function endItemId($data) { $this->_getCurrentOperation()->setId($data); $this->_getCurrentOperation()->getExemplaire()->setId($data); + + if ($this->_xml_parser->inParents('hold')) + $this->_getCurrentOperation()->setNoNotice(sprintf('%011d', $data)); } diff --git a/library/Class/WebService/SIGB/ExemplaireOperation.php b/library/Class/WebService/SIGB/ExemplaireOperation.php index 07aaeb16e3d0fdf7567cba7aaeec1975966ece76..3f1e1ee98d0d3065c7f5dadfbdba1fb1256f1c0e 100644 --- a/library/Class/WebService/SIGB/ExemplaireOperation.php +++ b/library/Class/WebService/SIGB/ExemplaireOperation.php @@ -173,6 +173,16 @@ abstract class Class_WebService_SIGB_ExemplaireOperation { } + /** + * @param no_notice int + * @return Class_WebService_SIGB_ExemplaireOperation + */ + public function setNoNotice($no_notice) { + $this->_exemplaire->setNoNotice($no_notice); + return $this; + } + + /** * @param exemplaire Class_Exemplaire * @return Class_WebService_SIGB_ExemplaireOperation diff --git a/tests/library/Class/WebService/SIGB/BiblixNetFixtures.php b/tests/library/Class/WebService/SIGB/BiblixNetFixtures.php index 7e0c4b3bdbaee8fbb644dfd5cc2d1007f6f3e1b9..f7069f5c3aac41095eebbe56632e87657f2c04ef 100644 --- a/tests/library/Class/WebService/SIGB/BiblixNetFixtures.php +++ b/tests/library/Class/WebService/SIGB/BiblixNetFixtures.php @@ -121,11 +121,11 @@ class BiblixNetFixtures { </loans> <holds> <hold> - <bibId>7307</bibId> + <itemId>7307</itemId> <state>En attente</state> </hold> <hold> - <bibId>14586</bibId> + <itemId>14586</itemId> <state>Disponible</state> </hold> </holds> diff --git a/tests/library/Class/WebService/SIGB/BiblixNetTest.php b/tests/library/Class/WebService/SIGB/BiblixNetTest.php index ae14cbe36a3a10f1b75cba20aa1005ef0093cf6e..f630087cc91c6afee3044034c4987eb37f068172 100644 --- a/tests/library/Class/WebService/SIGB/BiblixNetTest.php +++ b/tests/library/Class/WebService/SIGB/BiblixNetTest.php @@ -173,7 +173,16 @@ class BiblixNetGetPatronInfoJustinTicou extends BiblixNetTestCase { ->newInstanceWithId(34) ->setNotice( Class_Notice::getLoader() - ->newInstanceWithId('117661'))); + ->newInstanceWithId('117661'))) + + ->whenCalled('findFirstBy') + ->with(array('id_origine' => '00000007307')) + ->answers( + Class_Exemplaire::getLoader() + ->newInstanceWithId(36) + ->setNotice( + Class_Notice::getLoader() + ->newInstanceWithId('7307'))); } @@ -231,8 +240,8 @@ class BiblixNetGetPatronInfoJustinTicou extends BiblixNetTestCase { /** @test */ - public function firstHoldNoNoticeShouldBe7307() { - $this->assertEquals(7307, $this->_emprunteur->getReservations()[0]->getNoNotice()); + public function firstHoldExemplaireOPACShouldBeTheOneWithId36() { + $this->assertEquals(36, $this->_emprunteur->getReservations()[0]->getExemplaireOPAC()->getId()); }