From 95b5e2f94e0b1484ee03728c7eb84189d26e4bb8 Mon Sep 17 00:00:00 2001 From: Robert Williams Date: Thu, 18 Oct 2012 13:58:23 +1300 Subject: [PATCH] Bug 8939 : Fines being charged during the grace period Signed-off-by: Chris Cormack Signed-off-by: Paul Poulain --- C4/Overdues.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index d17f4452ef..ac66c365b9 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -263,10 +263,10 @@ sub CalcFine { my $chargeable_units = _get_chargeable_units($fine_unit, $start_date, $end_date, $branchcode); my $units_minus_grace = $chargeable_units - $data->{firstremind}; my $amount = 0; - if ($data->{'chargeperiod'} && $units_minus_grace ) { + if ($data->{'chargeperiod'} && ($units_minus_grace > 0) ) { $amount = int($chargeable_units / $data->{'chargeperiod'}) * $data->{'fine'};# TODO fine calc should be in cents } else { - # a zero (or null) chargeperiod means no charge. + # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. } $amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap}; $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units); -- 2.39.5