Bugzilla – Attachment 70059 Details for
Bug 19830
Add the Koha::Patron->old_checkout method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19830: Add the Koha::Patron->old_checkouts method
Bug-19830-Add-the-KohaPatron-oldcheckouts-method.patch (text/plain), 4.63 KB, created by
Kyle M Hall (khall)
on 2017-12-21 15:53:38 UTC
(
hide
)
Description:
Bug 19830: Add the Koha::Patron->old_checkouts method
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-12-21 15:53:38 UTC
Size:
4.63 KB
patch
obsolete
>From 7ffa4635a6f1dd6f94c0438181d40b6d37fe55e3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 18 Dec 2017 14:27:52 -0300 >Subject: [PATCH] Bug 19830: Add the Koha::Patron->old_checkouts method > >Test plan: > prove t/db_dependent/Koha/Patrons.t >must return green > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Patron.pm | 18 +++++++++++++++--- > t/db_dependent/Koha/Patrons.t | 26 +++++++++++++++++++++----- > 2 files changed, 36 insertions(+), 8 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 92e70a5..db2e9ac 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -512,14 +512,26 @@ sub add_enrolment_fee_if_needed { > > =head3 checkouts > >-my $issues = $patron->checkouts >+my $checkouts = $patron->checkouts > > =cut > > sub checkouts { > my ($self) = @_; >- my $issues = $self->_result->issues; >- return Koha::Checkouts->_new_from_dbic( $issues ); >+ my $checkouts = $self->_result->issues; >+ return Koha::Checkouts->_new_from_dbic( $checkouts ); >+} >+ >+=head3 old_checkouts >+ >+my $old_checkouts = $patron->old_checkouts >+ >+=cut >+ >+sub old_checkouts { >+ my ($self) = @_; >+ my $old_checkouts = $self->_result->old_issues; >+ return Koha::Old::Checkouts->_new_from_dbic( $old_checkouts ); > } > > =head3 get_overdues >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index bea2a02..c90a9f5 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -430,8 +430,8 @@ subtest 'add_enrolment_fee_if_needed' => sub { > $patron->delete; > }; > >-subtest 'checkouts + get_overdues' => sub { >- plan tests => 8; >+subtest 'checkouts + get_overdues + old_checkouts' => sub { >+ plan tests => 12; > > my $library = $builder->build( { source => 'Branch' } ); > my ($biblionumber_1) = AddBiblio( MARC::Record->new, '' ); >@@ -441,7 +441,9 @@ subtest 'checkouts + get_overdues' => sub { > value => { > homebranch => $library->{branchcode}, > holdingbranch => $library->{branchcode}, >- biblionumber => $biblionumber_1 >+ biblionumber => $biblionumber_1, >+ itemlost => 0, >+ withdrawn => 0, > } > } > ); >@@ -451,7 +453,9 @@ subtest 'checkouts + get_overdues' => sub { > value => { > homebranch => $library->{branchcode}, > holdingbranch => $library->{branchcode}, >- biblionumber => $biblionumber_1 >+ biblionumber => $biblionumber_1, >+ itemlost => 0, >+ withdrawn => 0, > } > } > ); >@@ -462,7 +466,9 @@ subtest 'checkouts + get_overdues' => sub { > value => { > homebranch => $library->{branchcode}, > holdingbranch => $library->{branchcode}, >- biblionumber => $biblionumber_2 >+ biblionumber => $biblionumber_2, >+ itemlost => 0, >+ withdrawn => 0, > } > } > ); >@@ -477,6 +483,9 @@ subtest 'checkouts + get_overdues' => sub { > my $checkouts = $patron->checkouts; > is( $checkouts->count, 0, 'checkouts should not return any issues for that patron' ); > is( ref($checkouts), 'Koha::Checkouts', 'checkouts should return a Koha::Checkouts object' ); >+ my $old_checkouts = $patron->old_checkouts; >+ is( $old_checkouts->count, 0, 'old_checkouts should not return any issues for that patron' ); >+ is( ref($old_checkouts), 'Koha::Old::Checkouts', 'old_checkouts should return a Koha::Old::Checkouts object' ); > > # Not sure how this is useful, but AddIssue pass this variable to different other subroutines > $patron = Koha::Patrons->find( $patron->borrowernumber )->unblessed; >@@ -499,6 +508,13 @@ subtest 'checkouts + get_overdues' => sub { > is( $overdues->next->itemnumber, $item_1->{itemnumber}, 'The issue should be returned in the same order as they have been done, first is correct' ); > is( $overdues->next->itemnumber, $item_2->{itemnumber}, 'The issue should be returned in the same order as they have been done, second is correct' ); > >+ >+ C4::Circulation::AddReturn( $item_1->{barcode} ); >+ C4::Circulation::AddReturn( $item_2->{barcode} ); >+ $old_checkouts = $patron->old_checkouts; >+ is( $old_checkouts->count, 2, 'old_checkouts should return 2 old checkouts that patron' ); >+ is( ref($old_checkouts), 'Koha::Old::Checkouts', 'old_checkouts should return a Koha::Old::Checkouts object' ); >+ > # Clean stuffs > Koha::Checkouts->search( { borrowernumber => $patron->borrowernumber } )->delete; > $patron->delete; >-- >2.10.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19830
:
69859
| 70059