From 9f250f8b9389fba0b4ef419458f8edd805a647f8 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 17 Jul 2014 10:57:06 -0400 Subject: [PATCH] Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue! When using the backdating of returns feature, an item that is not overdue is treated as being as many days overdue as it is *not* overdue. This is due to the fact that _get_chargeable_units appears to return the difference between the return date and the due date without consideration the return date being earlier than the due date. --- C4/Overdues.pm | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index 169b36c..e4cb241 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -283,6 +283,11 @@ C<$branchcode> is the branch whose calendar to use for finding holidays. sub _get_chargeable_units { my ($unit, $dt1, $dt2, $branchcode) = @_; + + # If the due date is later than the return date + return 0 if ( $dt1 > $dt2 ); + ## FIXME: Add unit test + my $charge_units = 0; my $charge_duration; if ($unit eq 'hours') { -- 1.7.2.5