From f9e2296ca2102820d742e63d808999cacbc43ecc Mon Sep 17 00:00:00 2001 From: Arthur Suzuki <arthur.suzuki@biblibre.com> Date: Thu, 20 Feb 2020 17:35:55 +0100 Subject: [PATCH] hotline#105149: do not display "place hold" button when item is not available for loan --- VERSIONS_HOTLINE/105149 | 1 + .../SIGB/Koha/GetRecordsResponseReader.php | 9 ++++--- tests/fixtures/KohaFixtures.php | 24 +++++++++++++++++++ .../Class/WebService/SIGB/KohaTest.php | 10 ++++++-- 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 VERSIONS_HOTLINE/105149 diff --git a/VERSIONS_HOTLINE/105149 b/VERSIONS_HOTLINE/105149 new file mode 100644 index 00000000000..176d584ff1a --- /dev/null +++ b/VERSIONS_HOTLINE/105149 @@ -0,0 +1 @@ + - ticket #105149 : Ne pas afficher le bouton "Réserver" dans le portail Bokeh si le status Koha est "Indisponible" \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Koha/GetRecordsResponseReader.php b/library/Class/WebService/SIGB/Koha/GetRecordsResponseReader.php index 45f93236930..2c71e276c91 100644 --- a/library/Class/WebService/SIGB/Koha/GetRecordsResponseReader.php +++ b/library/Class/WebService/SIGB/Koha/GetRecordsResponseReader.php @@ -123,9 +123,9 @@ class Class_WebService_SIGB_Koha_GetRecordsResponseReader { $this ->_handleItemWithdrawn() + ->_handleItemDateDue() ->_handleItemNotForLoan() ->_handleItemNumber() - ->_handleItemDateDue() ->_handleItemBarCode() ->_handleItemLost() ->_handleItemDamaged() @@ -253,11 +253,14 @@ class Class_WebService_SIGB_Koha_GetRecordsResponseReader { $data = (string)$this->_xml_item->notforloan; if (!array_key_exists($data, $this->_not_for_loan_status) - || $this->_item->isPiege()) + || $this->_item->isPiege()) { + $this->_item->setReservable(false); return $this; + } if (0 < (int)$data) - $this->_item->notForLoan(); + $this->_item->notForLoan() + ->setReservable(false); if ('' == $this->_item->getDateRetour()) $this->_item->setDisponibilite($this->_not_for_loan_status[$data]); diff --git a/tests/fixtures/KohaFixtures.php b/tests/fixtures/KohaFixtures.php index 733cffc4684..6fac4ea0fd4 100644 --- a/tests/fixtures/KohaFixtures.php +++ b/tests/fixtures/KohaFixtures.php @@ -811,6 +811,30 @@ class KohaFixtures { <dateaccessioned>2011-02-18</dateaccessioned> <itype>LIV</itype> </item> + <!-- 12 --> + <item> + <biblioitemnumber>33270</biblioitemnumber> + <wthdrawn>0</wthdrawn> + <holdingbranchname>Bibliothèque Départementale de la Meuse</holdingbranchname> + <notforloan>8</notforloan> + <replacementpricedate>2011-02-18</replacementpricedate> + <itemnumber>0239427</itemnumber> + <ccode>ROMJEUN</ccode> + <itemcallnumber>JR ROW h</itemcallnumber> + <date_due></date_due> + <barcode>2661660441</barcode> + <itemlost>0</itemlost> + <datelastseen>2011-02-18</datelastseen> + <homebranch>BDM</homebranch> + <homebranchname>Bibliothèque Départementale de la Meuse</homebranchname> + <biblionumber>33233</biblionumber> + <holdingbranch>BDM</holdingbranch> + <timestamp>2011-02-18 14:24:01</timestamp> + <damaged>0</damaged> + <cn_sort>JR_ROW_H</cn_sort> + <dateaccessioned>2011-02-18</dateaccessioned> + <itype>LIV</itype> + </item> </items> </record> </GetRecords>'; diff --git a/tests/library/Class/WebService/SIGB/KohaTest.php b/tests/library/Class/WebService/SIGB/KohaTest.php index 251fb60af1d..20f8fc948d4 100644 --- a/tests/library/Class/WebService/SIGB/KohaTest.php +++ b/tests/library/Class/WebService/SIGB/KohaTest.php @@ -233,8 +233,8 @@ class KohaServiceGetNoticeHarryPotterTest extends KohaServiceGetNoticeHarryPotte /** @test */ - public function getExemplairesShouldReturnAnArrayWithSizeEleven() { - $this->assertEquals(11, count($this->potter->getExemplaires())); + public function getExemplairesShouldReturnAnArrayWithSizeTwelve() { + $this->assertEquals(12, count($this->potter->getExemplaires())); } /** @test */ @@ -382,6 +382,12 @@ class KohaServiceGetNoticeHarryPotterTest extends KohaServiceGetNoticeHarryPotte public function eleventhExemplaireShouldNotBePilonne() { $this->assertFalse($this->potter->exemplaireAt(10)->isPilonne()); } + + + /** @test */ + public function twelfthExemplaireShouldNotBeReservable() { + $this->assertFalse($this->potter->exemplaireAt(11)->isReservable()); + } } -- GitLab