Bug 15770 - Number::Format issues with large numbers
Summary: Number::Format issues with large numbers
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
: 16832 17164 18774 19711 (view as bug list)
Depends on:
Blocks: 26239
  Show dependency treegraph
 
Reported: 2016-02-09 14:03 UTC by Julian Maurice
Modified: 2020-08-18 16:44 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 15770: Do not format numbers if too big (2.19 KB, patch)
2017-12-20 23:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15770: Do not format numbers if too big (2.24 KB, patch)
2018-01-19 15:29 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 15770: Do not format numbers if too big (2.29 KB, patch)
2018-01-19 16:23 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2016-02-09 14:03:11 UTC
In my database I have some large numbers in some database columns (categories.enrolmentfee for instance), because of TestBuilder I think.
In that case, this cause admin/categories.pl to die with the following error message:

Template process failed: undef error - round() overflow. Try smaller precision or use Math::BigFloat at /home/koha/src/Koha/Number/Price.pm line 44

This shouldn't happen in real life, but as Koha allows to enter such big numbers, this should probably be fixed.

Steps to reproduce:
1. Go to Admin ยป Categories
2. Click on "New category" button
3. Fill in the required field and set enrolment fee to a big number like 123456789012345 (15 digits seem to be the minimum to reproduce the bug)
4. Save
5. Boom!
Comment 1 Jonathan Druart 2016-07-06 15:16:42 UTC
*** Bug 16832 has been marked as a duplicate of this bug. ***
Comment 2 Jonathan Druart 2017-06-19 21:51:39 UTC
*** Bug 18774 has been marked as a duplicate of this bug. ***
Comment 3 Jonathan Druart 2017-12-20 23:33:07 UTC
Created attachment 69982 [details] [review]
Bug 15770: Do not format numbers if too big

At several places we got the following error if we use numbers too big
for Number::Format
Template process failed: undef error - round() overflow. Try smaller
precision or use Math::BigFloat at /home/koha/src/Koha/Number/Price.pm line 44

It make the app explodes.
The goal here is to handle these errors gracefully and easily.

Test plan:
- Add a manual fine to a patron of 100000000000000
- Create a patron category with an enrolment fee of 123456789012345
Comment 4 Jonathan Druart 2017-12-20 23:37:14 UTC
*** Bug 19711 has been marked as a duplicate of this bug. ***
Comment 5 Mark Tompsett 2018-01-19 15:29:13 UTC
Created attachment 70753 [details] [review]
Bug 15770: Do not format numbers if too big

At several places we got the following error if we use numbers too big
for Number::Format
Template process failed: undef error - round() overflow. Try smaller
precision or use Math::BigFloat at /home/koha/src/Koha/Number/Price.pm line 44

It make the app explodes.
The goal here is to handle these errors gracefully and easily.

Test plan:
- Add a manual fine to a patron of 100000000000000
- Create a patron category with an enrolment fee of 123456789012345

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 6 Nick Clemens 2018-01-19 16:23:51 UTC
Created attachment 70762 [details] [review]
Bug 15770: Do not format numbers if too big

At several places we got the following error if we use numbers too big
for Number::Format
Template process failed: undef error - round() overflow. Try smaller
precision or use Math::BigFloat at /home/koha/src/Koha/Number/Price.pm line 44

It make the app explodes.
The goal here is to handle these errors gracefully and easily.

Test plan:
- Add a manual fine to a patron of 100000000000000
- Create a patron category with an enrolment fee of 123456789012345

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Jonathan Druart 2018-01-19 18:55:26 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 8 Nick Clemens 2018-01-23 04:16:09 UTC
Awesome work all!

Pushed to Stable for 17.11.02
Comment 9 Fridolin Somers 2018-02-02 08:53:58 UTC
Pushed to 17.05.x for v17.05.09
Comment 10 Jonathan Druart 2018-06-06 17:37:45 UTC
*** Bug 17164 has been marked as a duplicate of this bug. ***