diff --git a/VERSIONS_HOTLINE/115393 b/VERSIONS_HOTLINE/115393 new file mode 100644 index 0000000000000000000000000000000000000000..c9f347cf859b3eb1c6b98407e3bbf8b4858b71d9 --- /dev/null +++ b/VERSIONS_HOTLINE/115393 @@ -0,0 +1 @@ + - ticket #115393 : SIGB Nanook : correction des réservations lorsque plusieurs annexes sont rattachées à une même bibliothèque \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Nanook/Service.php b/library/Class/WebService/SIGB/Nanook/Service.php index 0f5859a744e055b9ea376fe8ff5678782656c238..f4f71da4e88bb45555d8b417ba7620abbd782524 100644 --- a/library/Class/WebService/SIGB/Nanook/Service.php +++ b/library/Class/WebService/SIGB/Nanook/Service.php @@ -236,7 +236,10 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac */ public function reserverExemplaire($user, $exemplaire, $code_bib_or_annexe) { $code_annexe = $code_bib_or_annexe; - if ($annexe = Class_CodifAnnexe::findFirstBy(['id_bib' => $code_bib_or_annexe])) + if ( + ($annexe = Class_CodifAnnexe::findFirstBy(['id_origine' => $code_bib_or_annexe])) + || + ($annexe = Class_CodifAnnexe::findFirstBy(['id_bib' => $code_bib_or_annexe]))) $code_annexe = $annexe->getIdOrigine(); return $this->ilsdiHoldTitle(['bibId' => $exemplaire->getIdOrigine(), diff --git a/library/Class/WebService/SIGB/Nanook/XMLParser.php b/library/Class/WebService/SIGB/Nanook/XMLParser.php index 102b0c2947ea9437cad512b578fbe1cb756ee37b..a0db8e80fe0c55fcc4a22909f986848ab3be46d5 100644 --- a/library/Class/WebService/SIGB/Nanook/XMLParser.php +++ b/library/Class/WebService/SIGB/Nanook/XMLParser.php @@ -31,7 +31,7 @@ class Class_WebService_SIGB_Nanook_XMLParser extends Class_WebService_FasterXMLP $ret = ""; $length = strlen($xml); for ($i=0; $i < $length; $i++) { - $current = ord($xml{$i}); + $current = ord(substr($xml, $i, 1)); // http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char if (($current == 0x9) || ($current == 0xA) || diff --git a/tests/library/Class/WebService/SIGB/NanookTest.php b/tests/library/Class/WebService/SIGB/NanookTest.php index 13275664a461eae76f829b382223f7ee1407d8b7..9468ab70d53cb4ae196b0028f8fc5f83d2154b46 100644 --- a/tests/library/Class/WebService/SIGB/NanookTest.php +++ b/tests/library/Class/WebService/SIGB/NanookTest.php @@ -1160,6 +1160,27 @@ class NanookOperationsTest extends NanookTestCase { } + /** @test */ + public function reserverExemplaireOnExistingAnnexeOfLibraryWithTwoAnnexesShouldReturnSuccess() { + $this->fixture('Class_CodifAnnexe' , ['id' => 5, + 'libelle' => 'Archives', + 'id_bib' => 3, + 'id_origine' => 3]); + + $this->_mock_web_client + ->whenCalled('open_url') + ->with('http://localhost:8080/afi_Nanook/ilsdi/service/HoldTitle/bibId/196895/patronId/1/pickupLocation/3') + ->answers(NanookFixtures::xmlHoldTitleSuccess()); + + $this->assertEquals(array('statut' => true, 'erreur' => ''), + $this->_service->reserverExemplaire( + Class_Users::getLoader()->newInstance() ->setIdSigb('1'), + Class_Exemplaire::getLoader()->newInstance()->setIdOrigine('196895'), + 3 + )); + } + + /** @test */ public function reserverExemplaireShouldReturnFailureIfErrors() { $this->_mock_web_client