Bug 11698 - Add validity check for amount on budget page
Summary: Add validity check for amount on budget page
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
Depends on:
Reported: 2014-02-06 14:04 UTC by Nicole C. Engard
Modified: 2019-11-20 17:25 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:

budget (35.40 KB, image/png)
2014-02-06 14:04 UTC, Nicole C. Engard

Note You need to log in before you can comment on or make changes to this bug.
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.