Bugzilla – Attachment 107471 Details for
Bug 26076
Paying selected accountlines in full may result in the error "You must pay a value less than or equal to $x"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26076: Paying selected accountlines in full may result in the error "You must pay a value less than or equal to $x"
Bug-26076-Paying-selected-accountlines-in-full-may.patch (text/plain), 1.86 KB, created by
Kyle M Hall (khall)
on 2020-07-28 16:51:07 UTC
(
hide
)
Description:
Bug 26076: Paying selected accountlines in full may result in the error "You must pay a value less than or equal to $x"
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-07-28 16:51:07 UTC
Size:
1.86 KB
patch
obsolete
>From a47155c0a4eda01bb3ee0167df7705b85a3f4fda Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 28 Jul 2020 12:49:35 -0400 >Subject: [PATCH] Bug 26076: Paying selected accountlines in full may result in > the error "You must pay a value less than or equal to $x" > >This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE > >Test Plan: >1) Apply this patch >2) Restart all the things! >3) Verify that "Write off selected" functions as usual >--- > members/paycollect.pl | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/members/paycollect.pl b/members/paycollect.pl >index c258560bc9..a8f449e8ab 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -145,7 +145,7 @@ if ( $selected_accts ) { > } > my @acc = split /,/, $selected_accts; > >- @selected_accountlines = Koha::Account::Lines->search( >+ my $selected_accountlines = Koha::Account::Lines->search( > { > borrowernumber => $borrowernumber, > amountoutstanding => { '<>' => 0 }, >@@ -154,8 +154,9 @@ if ( $selected_accts ) { > { order_by => 'date' } > ); > >- $total_due = 0; # Reset and recalculate total due >- map { $total_due += $_->amountoutstanding } @selected_accountlines; >+ $total_due = $selected_accountlines->_resultset->get_column('amountoutstanding')->sum(); >+ >+ @selected_accountlines = $selected_accountlines->as_list; > } > > >-- >2.24.1 (Apple Git-126)
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 26076
:
107471
|
107503
|
107516
|
107589
|
107590
|
107591
|
108938
|
108939