Bug 11698

Summary: Add validity check for amount on budget page
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: AcquisitionsAssignee: Bugs List <koha-bugs>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: abl, jonathan.druart, katrin.fischer
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15770
Change sponsored?: --- Patch complexity: ---
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
Attachments: budget

Description Nicole C. Engard 2014-02-06 14:04:24 UTC
Created attachment 25074 [details]

I can't create a budget in master.  When I do I get this error:

Software error:

round() overflow. Try smaller precision or use Math::BigFloat at /home/nengard/kohaclone/admin/aqbudgetperiods.pl line 258.

For help, please send mail to the webmaster (webmaster@debian), giving this error message and the time and date of the error.
Comment 1 Nicole C. Engard 2014-02-06 14:05:11 UTC
Oh, and I should add that now I can't get to the existing budgets list either because it's giving me the same error....
Comment 2 Jacek Ablewicz 2014-02-09 14:05:48 UTC
Such thing happens after adding budget with 90071992547410 total amount or more - that's roughly 5x US national debt ;).
Plus, Koha accepts "Total amount" entered in scientific notation (eg. 1e14) so this might be the result of the typo.

Note #1: after it happens, I think it's not possible to delete such offending budget in any normal way; it needs to be deleted directly from the aqbudgetperiods table (or one can craft an url with ...?delete_confirmed=1&budget_period_id=.. to do so).
Note #2: this bug may be not reproducible in older installations (Number::Format module version < 1.72)

I guess an easy fix for this bug would be to add an extra validity check in javascript, so the form will not allow to save the budget if total amount entered is greater then 2**53/100. But - what if there are some people who need to use such big numbers in acquisition (think Zimbabwe..)?
Comment 3 Owen Leonard 2019-11-20 17:25:35 UTC
This appears to be fixed.