From 37e08b5a999fc534616c31c632687462f5530e50 Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@afi-sa.fr> Date: Tue, 12 Sep 2017 16:59:20 +0200 Subject: [PATCH] hotline #64528 : send branch id to Nanook GetPickupLocation --- VERSIONS_HOTLINE/64528 | 1 + library/Class/WebService/SIGB/Nanook/Service.php | 16 +++++++++++----- .../library/Class/WebService/SIGB/NanookTest.php | 14 +++++++++----- 3 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 VERSIONS_HOTLINE/64528 diff --git a/VERSIONS_HOTLINE/64528 b/VERSIONS_HOTLINE/64528 new file mode 100644 index 00000000000..41a593004b2 --- /dev/null +++ b/VERSIONS_HOTLINE/64528 @@ -0,0 +1 @@ + - ticket #64528 : SIGB Nanook : Bokeh transmet l'identifiant du site préféré lors de la demande des sites de retrait possibles pour une réservation \ 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 b075fff1b38..e26c803bea0 100644 --- a/library/Class/WebService/SIGB/Nanook/Service.php +++ b/library/Class/WebService/SIGB/Nanook/Service.php @@ -339,7 +339,9 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac return $this->_provide_pickup_locations; $result = $this->ilsdiAction('GetPickupLocation', - ['bibId' => 0, 'patronId' => 0], + ['bibId' => 0, + 'patronId' => 0, + 'siteId' => 0], 'error', ''); return $this->_provide_pickup_locations = !$this->_isNetworkError($result); @@ -347,12 +349,16 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac public function pickupLocationsFor($user, $item) { - if (!$this->providesPickupLocations() || !$user | !$item) + if (!$this->providesPickupLocations() + || !$user + || !$item + || !$item->getCodifAnnexe()) return parent::pickupLocationsFor($user, $item); - $params = ['service' => 'GetPickupLocation', - 'bibId' => $item->getIdOrigine(), - 'patronId' => $user->getIdSigb()]; + $params = ['service' => 'GetPickupLocation', + 'bibId' => $item->getIdOrigine(), + 'patronId' => $user->getIdSigb(), + 'siteId' => $item->getCodifAnnexe()->getIdOrigine()]; $xml = $this->httpGet($params); if ($this->_getTagData($xml, 'error')) diff --git a/tests/library/Class/WebService/SIGB/NanookTest.php b/tests/library/Class/WebService/SIGB/NanookTest.php index 8f85be61f62..3f3f5246507 100644 --- a/tests/library/Class/WebService/SIGB/NanookTest.php +++ b/tests/library/Class/WebService/SIGB/NanookTest.php @@ -1180,15 +1180,15 @@ class NanookPickupLocationsActiveTest extends NanookTestCase { parent::setUp(); $this->_mock_web_client ->whenCalled('open_url') - ->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPickupLocation/bibId/0/patronId/0') + ->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPickupLocation/bibId/0/patronId/0/siteId/0') ->answers(NanookFixtures::pickupLocationsPingAnswer()) ->whenCalled('open_url') - ->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPickupLocation/bibId/2/patronId/9') + ->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPickupLocation/bibId/2/patronId/9/siteId/11') ->answers(NanookFixtures::pickupLocationsOkAnswer()) ->whenCalled('open_url') - ->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPickupLocation/bibId/999/patronId/9') + ->with('http://localhost:8080/afi_Nanook/ilsdi/service/GetPickupLocation/bibId/999/patronId/9/siteId/34') ->answers(NanookFixtures::pickupLocationsErrorAnswer()) ->beStrict(); @@ -1204,7 +1204,9 @@ class NanookPickupLocationsActiveTest extends NanookTestCase { /** @test */ public function locationsForRecord2AndPatron9ShouldBeFirstAndSecondLibrary() { $user = (new Class_Entity)->setIdSigb(9); - $item = (new Class_Entity)->setIdOrigine(2); + $item = (new Class_Entity) + ->setIdOrigine(2) + ->setCodifAnnexe((new Class_Entity)->setIdOrigine(11)); $this->assertEquals([1 => 'First library', 2 => 'Second library'], $this->_service->pickupLocationsFor($user, $item)); @@ -1214,7 +1216,9 @@ class NanookPickupLocationsActiveTest extends NanookTestCase { /** @test */ public function locationsForRecord999AndPatron9ShouldBeEmpty() { $user = (new Class_Entity)->setIdSigb(9); - $item = (new Class_Entity)->setIdOrigine(999); + $item = (new Class_Entity) + ->setIdOrigine(999) + ->setCodifAnnexe((new Class_Entity)->setIdOrigine(34)); $this->assertEquals([], $this->_service->pickupLocationsFor($user, $item)); } -- GitLab