diff --git a/VERSIONS_WIP/70619 b/VERSIONS_WIP/70619 new file mode 100644 index 0000000000000000000000000000000000000000..30210d46b63dfaf4b10529a608c2792d26196aad --- /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 pour la liste des prêts. + \ No newline at end of file diff --git a/library/Class/Profil/Preferences/Loans.php b/library/Class/Profil/Preferences/Loans.php index b1e783e2e1c0b4cb14127b603d2bc14b10392aec..b37c8bdce8572e75a2c66e2d2ebcc39360ab91c6 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 5d78e05f55cb787933a46f3c58fd39d78af88a74..5864e7af7657d6bffb3c27e367a177743027d2ab 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 910ebd02ea381691faa1c8f04f5bf1df5a37308c..0e1b66f89bbaf5b9a2b308e372e98fceb420d2b1 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 7206bfb8507adc19f252cac70278361c6f7a43a9..0ca8d206c8e51901f9959132d36087a43a098185 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 c3790576d8360feb5a9c336e78d4c9df8c2ae8d7..b3c63a133d412c8e47c399dc9685fb66fc1aa178 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 a37b44022958bd4b8c40e1fe019dd7abddb6cc6d..d7d6f435813b55f52c4331ec1ffb631d83dea888 100644 --- a/tests/fixtures/ChamberyKohaFixtures.php +++ b/tests/fixtures/ChamberyKohaFixtures.php @@ -496,6 +496,7 @@ class ChamberyKohaFixtures { <frameworkcode></frameworkcode> <barcode>00519000083096</barcode> <onhold>1</onhold> + <renewals>28</renewals> <publicationyear>2004</publicationyear> <location>Romans enfant</location> <withdrawn>0</withdrawn> @@ -624,6 +625,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 2ad7ef06751d3509deaab431d0eaac623ee98cab..53686df4f23af0b39651730d663b6b4c818900a6 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')