Bug 33028: Fix calculations around cronjob fines.pl
authorThibaud Guillot <thibaud.guillot@biblibre.com>
Tue, 21 Feb 2023 16:05:45 +0000 (17:05 +0100)
committerPedro Amorim <pedro.amorim@ptfs-europe.com>
Thu, 17 Aug 2023 15:55:53 +0000 (15:55 +0000)
commit8da895d6f9d247ed37ff0313c46a42286fc80f92
tree6fdeb2475da86d77c9be3662de8bdcfae60ea45e
parentb5e1b2137fddf6a0ad854ffdb10c103a00c4f7fd
Bug 33028: Fix calculations around cronjob fines.pl

When currency format is set on FR commas are decimals separators
but when cron like fines.pl try to calculate fines it's fails due to
this format.

I changed this behavior by targetted 'fine' and 'overduefinescap' in
circulation_rules.rule_name to unformat them when we save them.

This also fix the display in smart_rules table (before with commas price
was not good displayed - without decimals)

Test Plan :
1) Set your currency format on 'FR' and 'fine' OR/AND 'overduefinescap'
with commas
2) Be sure to have some patron overdues
3) Run ~/misc/cronjobs/fines.pl with args to find overdues
4) See an error like 'isn't numeric in substraction[..] or gt > [...]'
5) Run updatedatabase script (it will replace commas in your rules
changed in step 1) )
6) Repeat step 3 and see that everything was going "fine" (:tada:)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1f9e161b412621c048c55741bab56b92c0b01a15)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 4f9eba2d232dcd709fe4ef74d37963f1e019569d)
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Koha/CirculationRules.pm
installer/data/mysql/atomicupdate/fix_calc_fines_fr-currency_21-11-MT39815.pl [new file with mode: 0755]