Bug 37507

Summary: Koha explodes when trying to apply discount higher than amount of manual invoice
Product: Koha Reporter: Roman Dolny <roman.dolny>
Component: Fines and feesAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: cj.lynce
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Roman Dolny 2024-07-26 21:33:10 UTC
When applying discount higher than amount of manual invoice Koha explodes with a message: "Exception 'Koha::Exceptions::ParameterTooHigh' thrown 'Amount to reduce (100) is higher than original amount (10.000000)' at /usr/share/perl5/Exception/Class/Base.pm line 88".

To reproduce:
1. Go to the patron -> accounting
2. Create manual invoice with positive amount (e.g. 10). Click Save.
3. In Transactions tab click 'Apply discount' button and enter discount to apply higher than amount entered in p. 2 (e.g. 100).
4. Koha explodes.
Comment 1 CJ Lynce 2024-08-04 20:56:42 UTC
I believe this has something to do with the 'Amount charged' price not populating when a price is divisible by .10 (a.k.a. ends in a 0 in the 2nd decimal place).

The check built into the 'Discount to apply' field is not working, because the amount is not being populated. Allowing you to enter an amount larger than the account line amount.

This is fixed with the patch I submitted on Bug 37563 which fixes the amount issuing not be populated, along with a number of other issues in the Accounting and POS modals.