Bugzilla – Attachment 122660 Details for
Bug 28482
Floating point math prevents items from being returned
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28482: [19.11.x] Refresh line from DB to get stored value
Bug-28482-1911x-Refresh-line-from-DB-to-get-stored.patch (text/plain), 1.76 KB, created by
Wainui Witika-Park
on 2021-07-08 01:42:48 UTC
(
hide
)
Description:
Bug 28482: [19.11.x] Refresh line from DB to get stored value
Filename:
MIME Type:
Creator:
Wainui Witika-Park
Created:
2021-07-08 01:42:48 UTC
Size:
1.76 KB
patch
obsolete
>From 081d491d9f4daf946929cfa9e0ab18ffb164bf71 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 28 May 2021 12:02:19 +0000 >Subject: [PATCH] Bug 28482: [19.11.x] 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 <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> >--- > Koha/Account/Line.pm | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 571c26a986..813276cce1 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -263,6 +263,8 @@ sub apply { > $self->amountoutstanding( $available_credit * -1 )->store; > $debit->amountoutstanding( $owed - $amount_to_cancel )->store; > >+ $debit->discard_changes; # Refresh values from DB to clear floating point remainders >+ > # Same logic exists in Koha::Account::pay > if ( $debit->amountoutstanding == 0 > && $debit->itemnumber >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28482
:
121476
|
121477
|
121479
|
121480
|
121586
|
121587
|
122646
|
122647
|
122659
| 122660