From 301074d8d15045acc0790ec6704bcf9ee3fa679e Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@afi-sa.fr> Date: Wed, 30 Apr 2014 16:27:45 +0200 Subject: [PATCH] =?UTF-8?q?#13394:=20SIGB=20Koha:=20r=C3=A9cup=C3=A8re=20l?= =?UTF-8?q?e=20site=20de=20retrait=20dans=20la=20liste=20des=20r=C3=A9serv?= =?UTF-8?q?ations=20(ILSDI=20=C3=A9lement=20<branchcode>)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSIONS | 3 +++ .../WebService/SIGB/Koha/PatronInfoReader.php | 12 ++++++++++-- .../Class/WebService/SIGB/KohaTest.php | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/VERSIONS b/VERSIONS index 94788f4ab43..993d3b78616 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,6 @@ + - ticket #13394: SIGB Koha: récupère le site de retrait dans la liste des réservations (ILSDI élement <branchcode>) + - ticket #13383: liste des prêts et réservations: pas de retour à la ligne pour l'en-tête de la première colonne (n°) + 29/04/2014 - v6.42.1 Webservice SIGB Koha: diff --git a/library/Class/WebService/SIGB/Koha/PatronInfoReader.php b/library/Class/WebService/SIGB/Koha/PatronInfoReader.php index b3dd81dce1b..9eae01b591c 100644 --- a/library/Class/WebService/SIGB/Koha/PatronInfoReader.php +++ b/library/Class/WebService/SIGB/Koha/PatronInfoReader.php @@ -57,9 +57,17 @@ class Class_WebService_SIGB_Koha_PatronInfoReader extends Class_WebService_SIGB_ public function endHoldingbranch($data) { + if ($this->_currentLoan) $this->updateBibliothequeWith($data); + } + + + public function endBranchcode($data) { + if ($this->_currentHold) $this->updateBibliothequeWith($data); + } + + public function updateBibliothequeWith($data) { $data = trim($data); - if (!$this->_currentLoan || !$data - || !($site = Class_CodifAnnexe::findFirstBy(['code' => $data]))) + if (!$data || !($site = Class_CodifAnnexe::findFirstBy(['code' => $data]))) return; $this->_current_operation->getExemplaire()->setBibliotheque($site->getLibelle()); diff --git a/tests/library/Class/WebService/SIGB/KohaTest.php b/tests/library/Class/WebService/SIGB/KohaTest.php index 5416169ba33..db575d506ac 100644 --- a/tests/library/Class/WebService/SIGB/KohaTest.php +++ b/tests/library/Class/WebService/SIGB/KohaTest.php @@ -321,6 +321,14 @@ class KohaGetEmprunteurLaureAfondTest extends KohaTestCase { public function setUp() { parent::setUp(); + $this->fixture('Class_CodifAnnexe', ['id' => 33, + 'libelle' => 'Biblio Meuse', + 'code' => 'BDM']); + + $this->fixture('Class_CodifAnnexe', ['id' => 34, + 'libelle' => 'Montmedy', + 'code' => 'MON']); + $this->mock_web_client ->expects($this->at(0)) ->method('open_url') @@ -372,6 +380,11 @@ class KohaGetEmprunteurLaureAfondTest extends KohaTestCase { $this->assertEquals(2, $this->laurent->getReservationAt(0)->getRang()); } + /** @test */ + function firstReservationBibliothequeShouldBeBiblioMeuse() { + $this->assertEquals('Biblio Meuse', $this->laurent->getReservationAt(0)->getBibliotheque()); + } + /** @test */ function reservationIdShouldBe27136() { @@ -395,6 +408,12 @@ class KohaGetEmprunteurLaureAfondTest extends KohaTestCase { function secondReservationNoticeIdShouldBe27139() { $this->assertEquals(27139, $this->laurent->getReservationAt(1)->getNoNotice()); } + + + /** @test */ + function secondReservationBibliothequeShouldBeMontmedy() { + $this->assertEquals('Montmedy', $this->laurent->getReservationAt(1)->getBibliotheque()); + } } -- GitLab