From 18904eeafcd798f115c653e1f74c8ecd95451422 Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Tue, 10 Jul 2018 11:44:04 +0200 Subject: [PATCH] dev #70619 add renewals column to loans table --- VERSIONS_WIP/70619 | 2 ++ library/Class/Profil/Preferences/Loans.php | 23 ++++++++++++++-- .../SIGB/AbstractILSDIPatronInfoReader.php | 6 +++++ library/Class/WebService/SIGB/Emprunt.php | 10 +++++++ library/Class/WebService/SIGB/Exemplaire.php | 12 +++++++++ .../WebService/SIGB/ExemplaireOperation.php | 4 +++ tests/fixtures/ChamberyKohaFixtures.php | 7 ++--- .../HandleOnholdTest/HandleOnholdTest.php | 27 ++++++++++++++++--- 8 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 VERSIONS_WIP/70619 diff --git a/VERSIONS_WIP/70619 b/VERSIONS_WIP/70619 new file mode 100644 index 00000000000..50eb41c77c4 --- /dev/null +++ b/VERSIONS_WIP/70619 @@ -0,0 +1,2 @@ + - ticket #70619 : Fiche abonné : ajout de la colonne "déjà prolongé" dans la liste des colonnes disponibles. + \ No newline at end of file diff --git a/library/Class/Profil/Preferences/Loans.php b/library/Class/Profil/Preferences/Loans.php index b1e783e2e1c..b37c8bdce85 100644 --- a/library/Class/Profil/Preferences/Loans.php +++ b/library/Class/Profil/Preferences/Loans.php @@ -191,8 +191,9 @@ class Class_Profil_Preferences_Loans { protected function _getOptionalItems() { - return ['Onhold', - 'LoanDate']; + return ['LoanDate', + 'Onhold', + 'Renewals']; } @@ -617,3 +618,21 @@ class Class_Profil_Preferences_LoansRowNumber extends Class_Profil_Preferences_L return $view_helper->line_no++; } } + + + +class Class_Profil_Preferences_LoansRenewals extends Class_Profil_Preferences_LoansAbstract { + public function getId() { + return 'renewals'; + } + + + public function getLabel() { + return $this->_('Déjà prolongé'); + } + + + public function renderWith($view_helper, $loan) { + return $loan->getRenewals(); + } +} diff --git a/library/Class/WebService/SIGB/AbstractILSDIPatronInfoReader.php b/library/Class/WebService/SIGB/AbstractILSDIPatronInfoReader.php index 5d78e05f55c..5864e7af765 100644 --- a/library/Class/WebService/SIGB/AbstractILSDIPatronInfoReader.php +++ b/library/Class/WebService/SIGB/AbstractILSDIPatronInfoReader.php @@ -133,6 +133,12 @@ abstract class Class_WebService_SIGB_AbstractILSDIPatronInfoReader { } + public function endRenewals($data) { + if ($data) + $this->_currentLoan->setRenewals($data); + } + + public function endItemonhold($data) { if ($data) $this->_currentLoan->setOnHold($data); diff --git a/library/Class/WebService/SIGB/Emprunt.php b/library/Class/WebService/SIGB/Emprunt.php index 910ebd02ea3..0e1b66f89bb 100644 --- a/library/Class/WebService/SIGB/Emprunt.php +++ b/library/Class/WebService/SIGB/Emprunt.php @@ -69,6 +69,16 @@ class Class_WebService_SIGB_Emprunt extends Class_WebService_SIGB_ExemplaireOper } + public function setRenewals($renewals) { + $this->_exemplaire->setRenewals($renewals); + } + + + public function getRenewals() { + return $this->_exemplaire->renewals(); + } + + public function onParseAttributes() { if( !$this->type = $this->getAttribute('Type')) $this->type = ''; diff --git a/library/Class/WebService/SIGB/Exemplaire.php b/library/Class/WebService/SIGB/Exemplaire.php index 7206bfb8507..0ca8d206c8e 100644 --- a/library/Class/WebService/SIGB/Exemplaire.php +++ b/library/Class/WebService/SIGB/Exemplaire.php @@ -56,6 +56,7 @@ class Class_WebService_SIGB_Exemplaire { protected $_issue_date; protected $consultation = false; protected $onhold = false; + protected $renewals = 0; public static function newInstance() { return new self(null); @@ -379,6 +380,17 @@ class Class_WebService_SIGB_Exemplaire { } + public function setRenewals($renewals) { + $this->renewals = $renewals; + return $this; + } + + + public function renewals() { + return $this->renewals; + } + + public function getEdition() { return $this->edition; } diff --git a/library/Class/WebService/SIGB/ExemplaireOperation.php b/library/Class/WebService/SIGB/ExemplaireOperation.php index c3790576d83..b3c63a133d4 100644 --- a/library/Class/WebService/SIGB/ExemplaireOperation.php +++ b/library/Class/WebService/SIGB/ExemplaireOperation.php @@ -131,6 +131,10 @@ abstract class Class_WebService_SIGB_ExemplaireOperation { } + public function getRenewals() { + return $this->_exemplaire->renewals(); + } + public function getIssueDate() { return $this->_exemplaire->getIssueDate(); diff --git a/tests/fixtures/ChamberyKohaFixtures.php b/tests/fixtures/ChamberyKohaFixtures.php index a37b4402295..817728abae4 100644 --- a/tests/fixtures/ChamberyKohaFixtures.php +++ b/tests/fixtures/ChamberyKohaFixtures.php @@ -92,7 +92,7 @@ class ChamberyKohaFixtures { <cn_sort>643_000000000000000_CAU</cn_sort> <dateaccessioned>2007-02-23</dateaccessioned> <onloan>2017-02-21</onloan> - <renewals>1</renewals> + <renewals>28</renewals> <price>35.00</price> <isbn>2-212-11624-1</isbn> <notforloan>0</notforloan> @@ -154,7 +154,7 @@ class ChamberyKohaFixtures { <datecreated>2016-12-19</datecreated> <date_due_sql>2017-02-21 23:59:00</date_due_sql> <onloan>2017-02-21</onloan> - <renewals>1</renewals> + <renewals>28</renewals> <price>18.00</price> <damaged>0</damaged> <issues>1</issues> @@ -208,7 +208,7 @@ class ChamberyKohaFixtures { <permanent_location>101</permanent_location> <issues>1</issues> <onloan>2017-02-21</onloan> - <renewals>1</renewals> + <renewals>28</renewals> <price>16.00</price> <isbn>978-2-212-12329-6</isbn> <notforloan>0</notforloan> @@ -624,6 +624,7 @@ class ChamberyKohaFixtures { <frameworkcode></frameworkcode> <barcode>00519000083096</barcode> <itemonhold>1</itemonhold> + <renewals>28</renewals> <publicationyear>2004</publicationyear> <location>Romans enfant</location> <withdrawn>0</withdrawn> diff --git a/tests/scenarios/HandleOnholdTest/HandleOnholdTest.php b/tests/scenarios/HandleOnholdTest/HandleOnholdTest.php index 2ad7ef06751..53686df4f23 100644 --- a/tests/scenarios/HandleOnholdTest/HandleOnholdTest.php +++ b/tests/scenarios/HandleOnholdTest/HandleOnholdTest.php @@ -48,7 +48,7 @@ abstract class HandleOnholdTestCase extends AbstractControllerTestCase { ->setController('abonne') ->setAction('prets'), ['tools_composition' => 'search_tool;export_barcodes;export_unimarc;extend_all;print;pager', - 'table_composition' => 'loaned_by;doctype;thumbnail;title;author;library;return_date;onhold']); + 'table_composition' => 'loaned_by;doctype;thumbnail;title;author;library;return_date;onhold;renewals']); $this->_ilsdi = 'http://chamb.com/koha/ilsdi.pl'; @@ -118,6 +118,27 @@ abstract class HandleOnholdDispatchTestCase extends HandleOnholdTestCase { } + /** @test */ + public function onHoldTdShouldContainsYes() { + $this->dispatch('/opac/abonne/prets', true); + $this->assertXPathContentContains('//td', 'Oui'); + } + + + /** @test */ + public function renewalsShouldDisplayAlreadyRenewed() { + $this->dispatch('/opac/abonne/prets', true); + $this->assertXPathContentContains('//th', 'Déjà prolongé'); + } + + + /** @test */ + public function renewalsTdShouldContains28() { + $this->dispatch('/opac/abonne/prets', true); + $this->assertXPathContentContains('//td', '28'); + } + + /** @test */ public function informationsShouldNotBeDisplayed() { $this->dispatch('/opac/abonne/prets', true); @@ -229,7 +250,7 @@ abstract class HandleOnholdDispatchTestCase extends HandleOnholdTestCase { -class HandleOnholdWithOnoldTest extends HandleOnholdDispatchTestCase { +class HandleOnholdWithOnHoldTest extends HandleOnholdDispatchTestCase { protected function _addCallToWebClient() { $this->_mock_web_client ->whenCalled('open_url') @@ -241,7 +262,7 @@ class HandleOnholdWithOnoldTest extends HandleOnholdDispatchTestCase { -class HandleOnholdWithItemonoldTest extends HandleOnholdDispatchTestCase { +class HandleOnholdWithItemOnHoldTest extends HandleOnholdDispatchTestCase { protected function _addCallToWebClient() { $this->_mock_web_client ->whenCalled('open_url') -- GitLab