Bug 26239 - Number::Format issues with large negative numbers
Summary: Number::Format issues with large negative numbers
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
Depends on: 15770
Blocks:
  Show dependency treegraph
 
Reported: 2020-08-18 16:43 UTC by Nick Clemens
Modified: 2020-11-30 21:52 UTC (History)
2 users (show)

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


Attachments
Bug 26239: Do not format large negative numbers (2.33 KB, patch)
2020-08-18 16:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 26239: Do not format large negative numbers (2.39 KB, patch)
2020-08-18 17:16 UTC, Amit Gupta
Details | Diff | Splinter Review
Error screenshot (8.59 KB, image/png)
2020-08-18 17:17 UTC, Amit Gupta
Details
Bug 26239: Do not format large negative numbers (2.46 KB, patch)
2020-08-18 21:31 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2020-08-18 16:43:19 UTC
Follow-up to bug 15770 for negative numbers
Comment 1 Nick Clemens 2020-08-18 16:44:22 UTC
Created attachment 108528 [details] [review]
Bug 26239: Do not format large negative numbers

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.

We fixed it for positive numbers in bug 15770, but we neglected the case of negative numbers

Test plan:
- Add a manual credit to a patron of 100000000000000
- ISE!
- Apply patch
- Restart all the things
-
Comment 2 Amit Gupta 2020-08-18 17:16:31 UTC
Created attachment 108530 [details] [review]
Bug 26239: Do not format large negative numbers

Test plan:
- Add a manual credit to a patron of 100000000000000
- ISE!
- Apply patch
- Restart all the things
-------------------------------
Checked and worked OK.
Comment 3 Amit Gupta 2020-08-18 17:17:19 UTC
Created attachment 108531 [details]
Error screenshot
Comment 4 Katrin Fischer 2020-08-18 21:31:10 UTC
Created attachment 108560 [details] [review]
Bug 26239: Do not format large negative numbers

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.

We fixed it for positive numbers in bug 15770, but we neglected the case of negative numbers

Test plan:
- Add a manual credit to a patron of 100000000000000
- ISE!
- Apply patch
- Restart all the things

Works perfectly.

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2020-08-19 07:36:40 UTC
Pushed to master for 20.11, thanks to everybody involved!