From: Bill Erickson Date: Mon, 11 Nov 2013 13:56:27 +0000 (-0500) Subject: LP#1249398 clear negative balance; cont. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Flp1249398-clear-negative-balance-ui-option;p=evergreen%2Fequinox.git LP#1249398 clear negative balance; cont. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm index ab3c7c484b..3921611964 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm @@ -960,6 +960,7 @@ __PACKAGE__->register_method( modifies (as appropriate) void payment(s) on the transaction to produce a zero-balance transaction, without affecting any of the billings or real patron payments. + Transactions which do not have a negative balance will be ignored. /, @@ -1001,7 +1002,7 @@ sub zeroize_transaction { my $remainder = $U->fpdiff(-$xact->balance_owed, $payment->amount); if ($remainder >= 0) { - # void payment is not large enough to bring us over $0, + # void payment is not large enough to take us beyond $0, # delete the whole payment. $logger->info("deleting void payment ".$payment->id. @@ -1011,11 +1012,12 @@ sub zeroize_transaction { return if $remainder == 0; # all done - # instead of doing math, fetch the updated transaction - # to get the latest value for balance_owed from the DB. + # fetch the updated transaction from the DB to get the most + # accurate value for balance_owed. $xact = $e->retrieve_money_billable_transaction_summary($xact->id); } else { + # update the void payment to use the difference between # the amount voided and the amount owed. $remainder = -$remainder; @@ -1059,7 +1061,7 @@ sub zeroize_transaction { # we don't check to see if the xact is already closed. since the # xact had a negative balance, it should not have been closed, so - # assume 'now' is the real close time regardless. + # assume 'now' is the correct close time regardless. my $trans = $e->retrieve_money_billable_transaction($xact_id); $trans->xact_finish("now");