Bug 26239: Do not format large negative numbers
authorNick Clemens <nick@bywatersolutions.com>
Tue, 18 Aug 2020 16:41:09 +0000 (16:41 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 19 Aug 2020 06:22:02 +0000 (08:22 +0200)
commit94a445d4138eaa0aaa89c49053b6ced8ca1ee0d1
tree1ba31af97d94c2b8349a10d3b8022ddeee1fd013
parenta0b5cefdc88a3671a0310a90490be275bab46860
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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Number/Price.pm
t/Number/Price.t