Bugzilla – Attachment 82736 Details for
Bug 21896
Add Koha::Account::reconcile_balance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21896: Add Koha::Account::normalize_balance
Bug-21896-Add-KohaAccountnormalizebalance.patch (text/plain), 1.67 KB, created by
Martin Renvoize (ashimema)
on 2018-11-29 13:51:26 UTC
(
hide
)
Description:
Bug 21896: Add Koha::Account::normalize_balance
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-11-29 13:51:26 UTC
Size:
1.67 KB
patch
obsolete
>From 9fcde2efb45d6f4fc699456cb20e4f9fa80f15c1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 27 Nov 2018 19:34:29 -0300 >Subject: [PATCH] Bug 21896: Add Koha::Account::normalize_balance > >This patch adds the normalize_balance() method to Koha::Account. Its >purpose is to apply outstanding credits (i.e. manual ones ore remaining >amounts like in the case of refunds) to outstanding debts. > >To test: >- Apply this patchset >- Run: > $ kshell > k$ prove t/db_dependent/Koha/Account.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Account.pm | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 4356411a1a..064489f65f 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -515,6 +515,33 @@ sub lines { > ); > } > >+=head3 normalize_balance >+ >+$account->normalize_balance(); >+ >+Find outstanding credits and use them to pay outstanding debits >+ >+=cut >+ >+sub normalize_balance { >+ my ($self) = @_; >+ >+ my $outstanding_debits = $self->outstanding_debits; >+ my $outstanding_credits = $self->outstanding_credits; >+ >+ while ( $outstanding_debits->total_outstanding > 0 >+ and my $credit = $outstanding_credits->next ) >+ { >+ # there's both outstanding debits and credits >+ $credit->apply( { debits => $outstanding_debits } ); # applying credit, no special offset >+ >+ $outstanding_debits = $self->outstanding_debits; >+ >+ } >+ >+ return $self; >+} >+ > 1; > > =head2 Name mappings >-- >2.19.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 21896
:
82684
|
82685
|
82688
|
82689
|
82690
|
82691
|
82692
|
82701
|
82702
|
82703
|
82720
|
82721
|
82722
|
82735
| 82736 |
82737
|
82738
|
82739
|
82740
|
82742
|
82811
|
82812
|
82813
|
82814
|
82815
|
82820