LP#1647852: Use correct method during adjust to zero on negative balance
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Thu, 27 Apr 2017 20:54:12 +0000 (13:54 -0700)
committerDan Wells <dbw2@calvin.edu>
Tue, 9 May 2017 13:03:32 +0000 (09:03 -0400)
Implementing Brent Mills' suggestion on Launchpad.

Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm

index 4b27e22..22d37a9 100644 (file)
@@ -966,7 +966,7 @@ sub _rebill_xact {
         if ($U->is_true($billing->voided)) {
             $amount = $billing->amount;
         } else { # adjusted billing
         if ($U->is_true($billing->voided)) {
             $amount = $billing->amount;
         } else { # adjusted billing
-            map { $amount = $U->fpadd($amount, $_->amount) } @{$billing->adjustments};
+            map { $amount = $U->fpsum($amount, $_->amount) } @{$billing->adjustments};
         }
         my $evt = $CC->create_bill(
             $e,
         }
         my $evt = $CC->create_bill(
             $e,
@@ -989,7 +989,7 @@ sub _is_fully_adjusted {
     my ($billing) = @_;
 
     my $amount_adj = 0;
     my ($billing) = @_;
 
     my $amount_adj = 0;
-    map { $amount_adj = $U->fpadd($amount_adj, $_->amount) } @{$billing->adjustments};
+    map { $amount_adj = $U->fpsum($amount_adj, $_->amount) } @{$billing->adjustments};
 
     return $billing->amount == $amount_adj;
 }
 
     return $billing->amount == $amount_adj;
 }