LP#1249398 clear negative balance; cont. lp1249398-clear-negative-balance-ui-option
authorBill Erickson <berick@esilibrary.com>
Mon, 11 Nov 2013 13:56:27 +0000 (08:56 -0500)
committerBill Erickson <berick@esilibrary.com>
Mon, 11 Nov 2013 13:56:27 +0000 (08:56 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm

index ab3c7c4..3921611 100644 (file)
@@ -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");