diff --git a/VERSIONS_HOTLINE/129168 b/VERSIONS_HOTLINE/129168 new file mode 100644 index 0000000000000000000000000000000000000000..c7ea3476c4e8275f9b0e4d71ea72e61cfa09260e --- /dev/null +++ b/VERSIONS_HOTLINE/129168 @@ -0,0 +1 @@ + - ticket #129168 : SIGB Carthame : Maintenance de la lecture de la localisation des exemplaires en prêt. \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Carthame/AccountResponseReader.php b/library/Class/WebService/SIGB/Carthame/AccountResponseReader.php index 35ae30f5a04ce30f6ec90ce12cf7eb2571bd6760..73862d21a5b12bf666e6a306701ef05b3f6a64e9 100644 --- a/library/Class/WebService/SIGB/Carthame/AccountResponseReader.php +++ b/library/Class/WebService/SIGB/Carthame/AccountResponseReader.php @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_WebService_SIGB_Carthame_AccountResponseReader { + use Trait_Translator; protected $_xml_parser, @@ -59,7 +60,7 @@ class Class_WebService_SIGB_Carthame_AccountResponseReader { public function startF490() { - $this->_current_emprunt = Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire(); + $this->_current_emprunt = Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire(); } @@ -129,12 +130,18 @@ class Class_WebService_SIGB_Carthame_AccountResponseReader { public function endSFd($data) { - if (!$this->_xml_parser->inParents('F500')) - return; + if ($this->_xml_parser->inParents('F500')) + return $this->_holdStatus($data); + + if ($this->_xml_parser->inParents('F400')) + return $this->_loanLibrary($data); + } - $mapping = ['A' => 'En attente', - 'D' => 'Disponible', - 'T' => 'En transfert']; + + protected function _holdStatus($data) { + $mapping = ['A' => $this->_('En attente'), + 'D' => $this->_('Disponible'), + 'T' => $this->_('En transfert')]; $data = (string)$data; $this->_current_reservation->setEtat(isset($mapping[$data]) ? $mapping[$data] : ''); @@ -144,6 +151,12 @@ class Class_WebService_SIGB_Carthame_AccountResponseReader { } + protected function _loanLibrary($data) { + if ($data) + $this->_current_emprunt->setBibliotheque((string)$data); + } + + public function endSFh($data) { if ($this->_xml_parser->inParents('F500')) $this->_current_reservation->setId((string)$data); diff --git a/tests/library/Class/WebService/SIGB/CarthameTest.php b/tests/library/Class/WebService/SIGB/CarthameTest.php index d0d56efc44a906a612782102b6ea7968a9d359ed..dad4853756f5d5d958db2278e5950e020b50fba4 100644 --- a/tests/library/Class/WebService/SIGB/CarthameTest.php +++ b/tests/library/Class/WebService/SIGB/CarthameTest.php @@ -627,7 +627,6 @@ class CarthameEmprunteurPatrickBTest extends CarthameOperationTestCase { $this->fixture('Class_Bib', ['id' => 47, 'libelle' => 'Bucarest']); - $this->mock_web_client->whenCalled('open_url') ->with('http://server.domain/webservices/index.php?sigb=karvi&version=standalone&idclient=bibkey&action=login&username=pbarroca&password=1974') ->answers(CarthameTestFixtures::createEmprunteurPatrickBLoginXml()) @@ -728,6 +727,12 @@ class CarthameEmprunteurPatrickBTest extends CarthameOperationTestCase { } + /** @test */ + public function firstEmpruntBibliothequeShouldBeAnnecy() { + $this->assertEquals('Annecy', $this->emprunteur->getEmpruntAt(0)->getBibliotheque()); + } + + /** @test */ public function secondEmpruntCopyIdShouldBe46666() { $this->assertEquals('46666', $this->emprunteur->getEmpruntAt(1)->getExemplaire()->getId()); @@ -1187,6 +1192,7 @@ class CarthameTestFixtures { <SFa>X108</SFa> <SFb>20110505</SFb> <SFc>20110526</SFc> + <SFd>Annecy</SFd> <SFk>45699</SFk> <SFl>0</SFl> </F400>