Bugzilla – Attachment 57989 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]
Bug 17585: Replace ->get_account_lines with ->account
Bug-17585-Replace--getaccountlines-with--account.patch (text/plain), 2.38 KB, created by
Jonathan Druart
on 2016-12-06 08:04:02 UTC
(
hide
)
Description:
Bug 17585: Replace ->get_account_lines with ->account
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-12-06 08:04:02 UTC
Size:
2.38 KB
patch
obsolete
>From a2aad44c38febfcd936fefa604a53b9020914f6e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 6 Dec 2016 07:58:34 +0000 >Subject: [PATCH] Bug 17585: Replace ->get_account_lines with ->account > >And return a Koha::Account instead of a Koha::Account::Lines >--- > Koha/Patron.pm | 9 ++++----- > t/db_dependent/Koha/Patrons.t | 20 ++++---------------- > 2 files changed, 8 insertions(+), 21 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 714c91b..a8c655b 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -519,16 +519,15 @@ sub get_overdues { > return $issues; > } > >-=head3 get_account_lines >+=head3 account > >-my $fines = $patron->get_account_lines >+my $account = $patron->account > > =cut > >-sub get_account_lines { >+sub account { > my ($self) = @_; >- my $account_lines = $self->_result->accountlines; >- return Koha::Account::Lines->_new_from_dbic($account_lines); >+ return Koha::Account->new( { patron_id => $self->borrowernumber } ); > } > > =head3 type >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 9e19ff8..0216806 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -471,26 +471,14 @@ subtest 'get_overdues' => sub { > $patron->delete; > }; > >-subtest 'get_account_lines' => sub { >- plan tests => 2; >+subtest 'account' => sub { >+ plan tests => 1; > > 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' ); >+ my $account = $patron->account; >+ is( ref($account), 'Koha::Account', 'account should return a Koha::Account object' ); > > $patron->delete; > }; >-- >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