From 5640a781829ea40d97e4149e38f537b9c784e105 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Tue, 9 May 2017 14:17:29 -0700 Subject: [PATCH] LP#1689656: Adjust to zero on negative balance Adjust to zero was not actually adjusting to zero on negative balances in at least some cases. This patch corrects that behavior. Test plan: [1] Generate multiple overdue billings on an overdue circ. [2] Apply a payment (cash or forgive) to resolve the overdue billings. [3] Checkin the item using backdated checkin or amnesty mode, such that the overdue billings are automatically voided, resulting in a negative balance. [4] Adjust to zero. A single new manual adjustment billing is created, reinstating one overdue billing, and then the adjust-to-zero process exits. The negative balance has been reduced by the amount of one overdue billing, rather than being fully adjusted to zero. [5] Apply the patch and restart services. [6] Repeat steps 1-3 with a new circulation. [7] Adjust to zero. This time, the balance should be correctly adjusted to zero, instead of exiting prematurely with an outstanding negative balance. Signed-off-by: Jeff Davis Signed-off-by: Dan Wells --- Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 22d37a996a..c434b155dc 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm @@ -981,7 +981,7 @@ sub _rebill_xact { $rebill_amount += $billing->amount; # if we have a postive (or zero) balance now, stop - last if $rebill_amount >= $xact_balance; + last if ($xact_balance + $rebill_amount >= 0); } } -- 2.11.0