Bugzilla – Attachment 10597 Details for
Bug 8251
Patrons are systematically debarred at checkin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patrons get incorrectly debarred
0001-Patrons-get-incorrectly-debarred.patch (text/plain), 1.79 KB, created by
Koha Team University Lyon 3
on 2012-07-02 09:52:33 UTC
(
hide
)
Description:
Patrons get incorrectly debarred
Filename:
MIME Type:
Creator:
Koha Team University Lyon 3
Created:
2012-07-02 09:52:33 UTC
Size:
1.79 KB
patch
obsolete
>From 494bd6d8a188d18b4cf3c7791c44a4f42f8e03b3 Mon Sep 17 00:00:00 2001 >From: Lyon3 Team <koha@univ-lyon3.fr> >Date: Mon, 2 Jul 2012 10:02:36 +0200 >Subject: [PATCH] Patrons get incorrectly debarred > >Patrons get incorrectly debarred because of the use of Datetime->delta_days >wich happens to always return a positive number. >Added a check to inverse the delta when patron is not late. >Also changed the use of Datetime->truncate function so it follows the docs, >using 'day' instead of 'days' (which is used in DateTime::Duration). >--- > Koha/Calendar.pm | 19 ++++++++++++------- > 1 files changed, 12 insertions(+), 7 deletions(-) > >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index f63e7eb..12971f4 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -173,14 +173,19 @@ sub days_between { > my $dateend_temp = $end_dt->clone(); > > # start and end should not be closed days >+ $datestart_temp->truncate( to => 'day' ); >+ $dateend_temp->truncate( to => 'day' ); > my $duration = $dateend_temp->delta_days($datestart_temp); >- $datestart_temp->truncate( to => 'days' ); >- $dateend_temp->truncate( to => 'days' ); >- while ( DateTime->compare( $datestart_temp, $dateend_temp ) == -1 ) { >- $datestart_temp->add( days => 1 ); >- if ( $self->is_holiday($datestart_temp) ) { >- $duration->subtract( days => 1 ); >- } >+ # if borrower is not late, delta days must be negative >+ if(DateTime->compare( $start_dt, $end_dt ) > -1){ >+ $duration = $duration->inverse; >+ } else { >+ while ( DateTime->compare( $datestart_temp, $dateend_temp ) == -1 ) { >+ $datestart_temp->add( days => 1 ); >+ if ( $self->is_holiday($datestart_temp) ) { >+ $duration->subtract( days => 1 ); >+ } >+ } > } > return $duration; > >-- >1.7.2.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8251
:
10289
|
10290
|
10308
|
10348
|
10418
|
10597
|
10767
|
10768
|
10914
|
11976
|
11979