Bugzilla – Attachment 76740 Details for
Bug 20990
Add Koha::Account::outstanding_credits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20990: Add Koha::Account->outstanding_credits
Bug-20990-Add-KohaAccount-outstandingcredits.patch (text/plain), 1.81 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-07-06 15:14:24 UTC
(
hide
)
Description:
Bug 20990: Add Koha::Account->outstanding_credits
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-07-06 15:14:24 UTC
Size:
1.81 KB
patch
obsolete
>From df2b849de4d8ab1e9d6b1d11e147f3ba23f980e5 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 25 Jun 2018 11:15:14 -0300 >Subject: [PATCH] Bug 20990: Add Koha::Account->outstanding_credits > >This patch adds a method that retrieves (for a patron's account) the >outstanding credits (i.e. those that haven't been applied to any debit. > >To test: >- Apply this patches >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Account.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Account.pm | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 8e3ed40798..1912e68ceb 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -422,6 +422,38 @@ sub outstanding_debits { > return $lines; > } > >+=head3 outstanding_credits >+ >+my ( $total, $lines ) = Koha::Account->new({ patron_id => $patron_id })->outstanding_credits; >+ >+=cut >+ >+sub outstanding_credits { >+ my ($self) = @_; >+ >+ my $outstanding_credits = Koha::Account::Lines->search( >+ { borrowernumber => $self->{patron_id}, >+ amountoutstanding => { '<' => 0 } >+ }, >+ { select => [ { sum => 'amountoutstanding' } ], >+ as => ['outstanding_credits_total'], >+ } >+ ); >+ my $total >+ = ( $outstanding_credits->count ) >+ ? $outstanding_credits->next->get_column('outstanding_credits_total') + 0 >+ : 0; >+ >+ my $lines = Koha::Account::Lines->search( >+ { >+ borrowernumber => $self->{patron_id}, >+ amountoutstanding => { '<' => 0 } >+ } >+ ); >+ >+ return ( $total, $lines ); >+} >+ > =head3 non_issues_charges > > my $non_issues_charges = $self->non_issues_charges >-- >2.18.0
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 20990
:
76380
|
76381
|
76405
|
76406
|
76407
|
76446
|
76447
|
76448
|
76449
|
76525
|
76640
|
76739
| 76740 |
76741
|
76742
|
76743