From cc3bc9201e486a93d6b273ae902152730b04b09c Mon Sep 17 00:00:00 2001 From: Lyon3 Team Date: Fri, 15 Jun 2012 13:16:11 +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 | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm index 75c5c9e..1f69f6f 100644 --- a/Koha/Calendar.pm +++ b/Koha/Calendar.pm @@ -170,7 +170,11 @@ sub days_between { my $end_dt = shift; # start and end should not be closed days - my $duration = $end_dt->delta_days($start_dt); + my $duration = $end_dt->delta_days($start_dt);i + # 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