From 7584bea853cbd9a70d214a73023f0b47b1fc9007 Mon Sep 17 00:00:00 2001 From: Lyon3 Team Date: Fri, 15 Jun 2012 15:49:02 +0200 Subject: [PATCH] Patrons systematically debarred at checkin When fines in days are used in issuing rules, the patrons who were not late were systematically debarred with a debarred date equal to the the initial due date --- Koha/Calendar.pm | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm index 75c5c9e..342d38e 100644 --- a/Koha/Calendar.pm +++ b/Koha/Calendar.pm @@ -171,6 +171,10 @@ sub days_between { # start and end should not be closed days my $duration = $end_dt->delta_days($start_dt); + # if borrower is not late, delta days must be negative + if(DateTime->compare( $start_dt, $end_dt ) > -1){ + $duration->{'days'} = - $duration->{'days'}; + } $start_dt->truncate( to => 'days' ); $end_dt->truncate( to => 'days' ); while ( DateTime->compare( $start_dt, $end_dt ) == -1 ) { -- 1.7.2.5