Bugzilla – Attachment 57902 Details for
Bug 17585
Add the Koha::Patron->account method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 17585: Add the Koha::Patron->get_account_lines method
SIGNED-OFF-Bug-17585-Add-the-KohaPatron-getaccount.patch (text/plain), 2.42 KB, created by
Josef Moravec
on 2016-12-02 09:09:15 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 17585: Add the Koha::Patron->get_account_lines method
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2016-12-02 09:09:15 UTC
Size:
2.42 KB
patch
obsolete
>From c417d3bf29c1076d5b88df597fca80d712b8ab97 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 8 Nov 2016 13:19:39 +0000 >Subject: [PATCH] [SIGNED-OFF] Bug 17585: Add the > Koha::Patron->get_account_lines method > >Test plan: > prove t/db_dependent/Koha/Patrons.t >should return green > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/Patron.pm | 12 ++++++++++++ > t/db_dependent/Koha/Patrons.t | 26 +++++++++++++++++++++++++- > 2 files changed, 37 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 9e0f880..2a01c6d 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -519,6 +519,18 @@ sub get_overdues { > return $issues; > } > >+=head3 get_account_lines >+ >+my $fines = $patron->get_account_lines >+ >+=cut >+ >+sub get_account_lines { >+ my ($self) = @_; >+ my $account_lines = $self->_result->accountlines; >+ return Koha::Account::Lines->_new_from_dbic($account_lines); >+} >+ > =head3 type > > =cut >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 1ea241b..0118f14 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 14; >+use Test::More tests => 16; > use Test::Warn; > use DateTime; > >@@ -471,6 +471,30 @@ subtest 'get_overdues' => sub { > $patron->delete; > }; > >+subtest 'get_account_lines' => sub { >+ plan tests => 2; >+ >+ my $patron = $builder->build({source => 'Borrower'}); >+ >+ my $accountline_1 = $builder->build({ source => 'Accountline', >+ value => { borrowernumber => $patron->{borrowernumber}, >+ amount => 42, >+ amountoutstanding => 42 } >+ }); >+ my $accountline_2 = $builder->build({ source => 'Accountline', >+ value => { borrowernumber => $patron->{borrowernumber}, >+ amount => -13, >+ amountoutstanding => -13 } >+ }); >+ >+ $patron = Koha::Patrons->find( $patron->{borrowernumber} ); >+ my $account_lines = $patron->get_account_lines; >+ is( $account_lines->count, 2, 'There should have 2 account lines for that patron' ); >+ is( ref($account_lines), 'Koha::Account::Lines', 'get_account_lines should return a Koha::Account::Lines object' ); >+ >+ $patron->delete; >+}; >+ > $retrieved_patron_1->delete; > is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); > >-- >2.1.4
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 17585
:
57335
|
57336
|
57899
|
57902
|
57930
|
57987
|
57988
|
57989