From 6c6bda4b6ddf607aba67a2e5de28beda92a6f98d 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 --- C4/Overdues.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index d17f445..ac66c36 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); -- 1.7.9.5