Bugzilla – Attachment 10767 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]
[SIGNED-OFF] Bug 8251 - Follow up, use 'day' instead of 'day' for Datetime::truncate
Bug-8251---Follow-up-use-day-instead-of-day-for-Da.patch (text/plain), 7.29 KB, created by
Dobrica Pavlinusic
on 2012-07-11 13:10:42 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 8251 - Follow up, use 'day' instead of 'day' for Datetime::truncate
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2012-07-11 13:10:42 UTC
Size:
7.29 KB
patch
obsolete
>From 3f346c47ba076f02cf2ec5c237d49b16fc735c8e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Thu, 21 Jun 2012 11:27:20 -0300 >Subject: [PATCH] Bug 8251 - Follow up, use 'day' instead of 'day' for Datetime::truncate > >As noted in comment #4 by Jonathan Druart, this should be fixed in every call >to DateTie::truncate function. This patch does exactly that. > >julian_m tested that truncate( to => 'days' ) didn't actually do anything, so >it is understandable that this 'fix' might introduce new bugs as we might have >'fixed' at a higher libs level this issue. > >'minutes' is used in truncate function too, so fixing. > >Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org> >--- > C4/Circulation.pm | 18 +++++++++--------- > Koha/Calendar.pm | 6 +++--- > Koha/DateUtils.pm | 4 ++-- > circ/overdue.pl | 2 +- > circ/returns.pl | 2 +- > members/moremember.pl | 4 ++-- > 6 files changed, 18 insertions(+), 18 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index ca2e94d..6279550 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -701,7 +701,7 @@ sub CanBookBeIssued { > } > if ($duedate) { > my $today = $now->clone(); >- $today->truncate( to => 'minutes'); >+ $today->truncate( to => 'minute'); > if (DateTime->compare($duedate,$today) == -1 ) { # duedate cannot be before now > $needsconfirmation{INVALID_DATE} = output_pref($duedate); > } >@@ -738,8 +738,8 @@ sub CanBookBeIssued { > day => $d, > time_zone => C4::Context->tz, > ); >- $expiry_dt->truncate( to => 'days'); >- my $today = $now->clone()->truncate(to => 'days'); >+ $expiry_dt->truncate( to => 'day'); >+ my $today = $now->clone()->truncate(to => 'day'); > if (DateTime->compare($today, $expiry_dt) == 1) { > $issuingimpossible{EXPIRED} = 1; > } >@@ -1051,7 +1051,7 @@ sub AddIssue { > $datedue = CalcDateDue( $issuedate, $itype, $branch, $borrower ); > > } >- $datedue->truncate( to => 'minutes'); >+ $datedue->truncate( to => 'minute'); > $sth->execute( > $borrower->{'borrowernumber'}, # borrowernumber > $item->{'itemnumber'}, # itemnumber >@@ -2084,10 +2084,10 @@ sub GetItemIssue { > my $data = $sth->fetchrow_hashref; > return unless $data; > $data->{issuedate} = dt_from_string($data->{issuedate}, 'sql'); >- $data->{issuedate}->truncate(to => 'minutes'); >+ $data->{issuedate}->truncate(to => 'minute'); > $data->{date_due} = dt_from_string($data->{date_due}, 'sql'); >- $data->{date_due}->truncate(to => 'minutes'); >- my $dt = DateTime->now( time_zone => C4::Context->tz)->truncate( to => 'minutes'); >+ $data->{date_due}->truncate(to => 'minute'); >+ my $dt = DateTime->now( time_zone => C4::Context->tz)->truncate( to => 'minute'); > $data->{'overdue'} = DateTime->compare($data->{'date_due'}, $dt ) == -1 ? 1 : 0; > return $data; > } >@@ -2132,7 +2132,7 @@ sub GetItemIssues { > my ( $itemnumber, $history ) = @_; > > my $today = DateTime->now( time_zome => C4::Context->tz); # get today date >- $today->truncate( to => 'minutes' ); >+ $today->truncate( to => 'minute' ); > my $sql = "SELECT * FROM issues > JOIN borrowers USING (borrowernumber) > JOIN items USING (itemnumber) >@@ -2154,7 +2154,7 @@ sub GetItemIssues { > my $results = $sth->fetchall_arrayref({}); > foreach (@$results) { > my $date_due = dt_from_string($_->{date_due},'sql'); >- $date_due->truncate( to => 'minutes' ); >+ $date_due->truncate( to => 'minute' ); > > $_->{overdue} = (DateTime->compare($date_due, $today) == -1) ? 1 : 0; > } >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index dc132cd..f31edf2 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -147,7 +147,7 @@ sub is_holiday { > if ( $self->{weekly_closed_days}->[$dow] == 1 ) { > return 1; > } >- $dt->truncate( to => 'days' ); >+ $dt->truncate( to => 'day' ); > my $day = $dt->day; > my $month = $dt->month; > if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) { >@@ -189,8 +189,8 @@ sub days_between { > sub hours_between { > my ($self, $start_dt, $end_dt) = @_; > my $duration = $end_dt->delta_ms($start_dt); >- $start_dt->truncate( to => 'days' ); >- $end_dt->truncate( to => 'days' ); >+ $start_dt->truncate( to => 'day' ); >+ $end_dt->truncate( to => 'day' ); > # NB this is a kludge in that it assumes all days are 24 hours > # However for hourly loans the logic should be expanded to > # take into account open/close times then it would be a duration >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index e2e92bd..a1fd088 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -158,7 +158,7 @@ sub format_sqldatetime { > my $force_pref = shift; # if testing we want to override Context > if ( defined $str && $str =~ m/^\d{4}-\d{2}-\d{2}/ ) { > my $dt = dt_from_string( $str, 'sql' ); >- $dt->truncate( to => 'minutes' ); >+ $dt->truncate( to => 'minute' ); > return output_pref( $dt, $force_pref ); > } > return q{}; >@@ -178,7 +178,7 @@ sub format_sqlduedatetime { > my $force_pref = shift; # if testing we want to override Context > if ( defined $str && $str =~ m/^\d{4}-\d{2}-\d{2}/ ) { > my $dt = dt_from_string( $str, 'sql' ); >- $dt->truncate( to => 'minutes' ); >+ $dt->truncate( to => 'minute' ); > return output_pref_due( $dt, $force_pref ); > } > return q{}; >diff --git a/circ/overdue.pl b/circ/overdue.pl >index 56e0941..e44e792 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -239,7 +239,7 @@ if ($noreport) { > > > my $today_dt = DateTime->now(time_zone => C4::Context->tz); >- $today_dt->truncate(to => 'minutes'); >+ $today_dt->truncate(to => 'minute'); > my $todaysdate = $today_dt->strftime('%Y-%m-%d %H:%M'); > > $bornamefilter =~s/\*/\%/g; >diff --git a/circ/returns.pl b/circ/returns.pl >index 38e9887..b9127da 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -250,7 +250,7 @@ if ($barcode) { > ); > > if ($returned) { >- my $time_now = DateTime->now( time_zone => C4::Context->tz )->truncate( to => 'minutes'); >+ my $time_now = DateTime->now( time_zone => C4::Context->tz )->truncate( to => 'minute'); > my $duedate = $issueinformation->{date_due}->strftime('%Y-%m-%d %H:%M'); > $returneditems{0} = $barcode; > $riborrowernumber{0} = $borrower->{'borrowernumber'}; >diff --git a/members/moremember.pl b/members/moremember.pl >index 8f529f3..25ae7e9 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -251,7 +251,7 @@ if ( @borrowernumbers ) { > } > my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} ); > my $today = DateTime->now( time_zone => C4::Context->tz); >-$today->truncate(to => 'days'); >+$today->truncate(to => 'day'); > my @borrowers_with_issues; > my $overdues_exist = 0; > my $totalprice = 0; >@@ -494,7 +494,7 @@ sub build_issue_data { > $row{red} = 1; > } > if ($issuedate) { >- $issuedate->truncate( to => 'days' ); >+ $issuedate->truncate( to => 'day' ); > if ( DateTime->compare( $issuedate, $today ) == 0 ) { > $row{today} = 1; > } >-- >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