Bug 15770: Do not format numbers if too big
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 20 Dec 2017 23:29:29 +0000 (20:29 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 2 Feb 2018 08:45:54 +0000 (09:45 +0100)
commit9b220314b2a85130ef8df86948b3eb0a2ba77460
tree685be784b558747ba572b49daec11d080f37a669
parent7084f4689543470ecdee3b13588a5ea425bee62e
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 937237a1f29192c8be73fbcc3cd7e29c40468831)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Number/Price.pm
t/Number/Price.t