Bug 30788: Fix warning in Overdues.pm when fine is empty in circ rules

Argument "" isn't numeric in multiplication (*) at /usr/share/koha/lib/C4/Overdues.pm

To test:
* Create a issuing rule where fine is empty, but a fine interval is set.
  Fine amount: empty
  To do this, remove the 0 displayed in the input field before saving.
  Fine charging interval: 5 or any other numeric value
  When to charge: Start of interval
  Fine grace period: 0
* Check out an item with the due date yester (use specify due date)
* Run misc/cronjobs/fines.pl -v
* You should see above warn in the output
* Apply patch
* Rerun fines.pl, there should be no warn.
* Run:
  t/db_dependent/Circulation/CalcFine.t
  t/db_dependent/Fines.t
  t/db_dependent/Circulation.t
  t/db_dependent/Overdues.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Katrin Fischer 2022-05-20 09:43:15 +02:00 committed by Tomas Cohen Arazi
parent 54a6c73c6d
commit 368bdcf4e9
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 1 additions and 1 deletions

View File

@ -274,7 +274,7 @@ sub CalcFine {
# biblio-level recall
$amount = $charge_periods * $issuing_rule->{recall_overdue_fine};
}
if ( scalar @recalls == 0 ) {
if ( scalar @recalls == 0 && $issuing_rule->{fine}) {
# no recall, use normal fine amount
$amount = $charge_periods * $issuing_rule->{fine};
}