From: Tomas Cohen Arazi Date: Fri, 15 Jun 2012 17:51:42 +0000 (-0300) Subject: Bug 8251 - Patrons get incorrectly debarred X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=c6f1f64cb71e9d8ec560a201a4a0bc16c1510f3f;p=koha.git Bug 8251 - Patrons get incorrectly debarred Patrons get incorrectly debarred because of the use of Datetime->delta_days wich happens to always return a positive number. Also changed the use of Datetime->truncate function so it follows the docs, using 'day' instead of 'days' (which is used in DateTime::Duration). This patch has been tested against master. Signed-off-by: Julian Maurice Signed-off-by: Paul Poulain --- diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm index f63e7eb891..dc132cd2ac 100644 --- a/Koha/Calendar.pm +++ b/Koha/Calendar.pm @@ -173,9 +173,9 @@ sub days_between { my $dateend_temp = $end_dt->clone(); # start and end should not be closed days - my $duration = $dateend_temp->delta_days($datestart_temp); - $datestart_temp->truncate( to => 'days' ); - $dateend_temp->truncate( to => 'days' ); + $datestart_temp->truncate( to => 'day' ); + $dateend_temp->truncate( to => 'day' ); + my $duration = $dateend_temp - $datestart_temp; while ( DateTime->compare( $datestart_temp, $dateend_temp ) == -1 ) { $datestart_temp->add( days => 1 ); if ( $self->is_holiday($datestart_temp) ) {