Bugzilla – Attachment 31280 Details for
Bug 12847
Date comparisons in C4::Members::IssueSlip are broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12847 - Date comparisons in C4::Members::IssueSlip are broken
Bug-12847---Date-comparisons-in-C4MembersIssueSlip.patch (text/plain), 2.26 KB, created by
Kyle M Hall (khall)
on 2014-08-29 13:42:36 UTC
(
hide
)
Description:
Bug 12847 - Date comparisons in C4::Members::IssueSlip are broken
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-08-29 13:42:36 UTC
Size:
2.26 KB
patch
obsolete
>From 5935132dd9342fdaccdc49cc81deebbea4d4a4d5 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 29 Aug 2014 09:40:09 -0400 >Subject: [PATCH] Bug 12847 - Date comparisons in C4::Members::IssueSlip are broken > >Test Plan: >1) Ensure you have the default Koha issue slip >2) Check out an item >3) Print the issue slip for that patron >4) Even though the item is not overdue, it will show in the 'Overdues' section >5) Apply this patch >6) Re-print the issue slip >7) The item should no longer be in the overdues section >--- > C4/Members.pm | 24 ++++++++++++++++-------- > 1 files changed, 16 insertions(+), 8 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 326344d..2c388fe 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -2346,20 +2346,28 @@ sub DeleteMessage { > sub IssueSlip { > my ($branch, $borrowernumber, $quickslip) = @_; > >-# return unless ( C4::Context->boolean_preference('printcirculationslips') ); >- >- my $now = POSIX::strftime("%Y-%m-%d", localtime); >+ my $now = dt_from_string(); >+ $now->truncate( to => 'day' ); > > my $issueslist = GetPendingIssues($borrowernumber); >- foreach my $it (@$issueslist){ >- if ((substr $it->{'issuedate'}, 0, 10) eq $now || (substr $it->{'lastreneweddate'}, 0, 10) eq $now) { >+ foreach my $it (@$issueslist) { >+ >+ my $dt_issuedate = dt_from_string( $it->{'issuedate'} ); >+ $dt_issuedate->truncate( to => 'day' ); >+ my $dt_lastreneweddate = dt_from_string( $it->{'lastreneweddate'} ); >+ $dt_lastreneweddate->truncate( to => 'day' ); >+ my $dt_date_due = dt_from_string( $it->{'date_due'} ); >+ $dt_date_due->truncate( to => 'day' ); >+ >+ if ( $dt_issuedate == $now || $dt_lastreneweddate == $now ) { > $it->{'now'} = 1; > } >- elsif ((substr $it->{'date_due'}, 0, 10) le $now) { >+ elsif ( $dt_date_due < $now ) { > $it->{'overdue'} = 1; > } >- my $dt = dt_from_string( $it->{'date_due'} ); >- $it->{'date_due'} = output_pref( $dt );; >+ >+ # Recreate date_due as DateTime because we truncated the hours >+ $it->{'date_due'} = output_pref( dt_from_string( $it->{'date_due'} ) ); > } > my @issues = sort { $b->{'timestamp'} <=> $a->{'timestamp'} } @$issueslist; > >-- >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 12847
:
31280
|
31281
|
31286
|
35969
|
36048
|
36049
|
37908
|
37946
|
37992
|
38020
|
38302