From eaa1e75b992d8748857561f3ad4283b38c676774 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 28 May 2021 12:02:19 +0000 Subject: [PATCH] Bug 28482: Refresh line from DB to get stored value Before checking if the amount is 0 we get the stored value from the DB. This ensures any amounts beyond the 6 digit precision we store will be removed. To test: 1 - Add a processing fee of 15 to an itemtype 2 - Add an item of that type, set the replacement fee to 12.63 3 - Set MarkLostItemsAsReturned to 'On payment' only 4 - Set WhenLostChargeReplacementFee to 'Charge' 5 - Checkout the item to a patron 6 - Mark the item lost 7 - Reload patron and confirm they are charged 27.63 8 - Go to accounting, pay amount, pay 27.63 9 - Item is still lost and not returned 10 - Apply patch 11 - Checkin the item 12 - Checkout to another patron 13 - Mark lost 14 - Patron charged 27.63 15 - Pay amount, 27.63 16 - Item returned! Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- Koha/Account/Line.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 9418267625..bd233e3b36 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -666,6 +666,7 @@ sub apply { } ) if $outcome; } + $debit->discard_changes; # Refresh values from DB to clear floating point remainders # Same logic exists in Koha::Account::pay if ( -- 2.39.5