Bugzilla – Attachment 43405 Details for
Bug 14916
Overdues are not listed if due on 23:59 of the 'to date' (Was: Remove C4::Dates from circ/overdue.pl)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14916: Display overdues if due on 23:59
Bug-14916-Display-overdues-if-due-on-2359.patch (text/plain), 5.92 KB, created by
Marc Véron
on 2015-10-14 17:17:37 UTC
(
hide
)
Description:
Bug 14916: Display overdues if due on 23:59
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-10-14 17:17:37 UTC
Size:
5.92 KB
patch
obsolete
>From 477043b63c323bbe04f058521a34599eadd40396 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 28 Sep 2015 16:44:30 +0200 >Subject: [PATCH] Bug 14916: Display overdues if due on 23:59 >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >If an item is due on today 23:59 and the filter is from yesterday to today, the overdue won't appear on the list. > >Test plan: >Be sure you have an item due on DATE 23:59 >Search for overdues from DATE-1 to DATE >Without this patch, the item won't appear. >With this patch, it will. > >Regression test: test the CSV download. > >Note: On the way, this patch remove the deps to C4::Dates (which was the >original goal of the bug report). > >Issue reproduced, it's resloved with this patch. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > circ/overdue.pl | 35 ++++++++++---------- > .../intranet-tmpl/prog/en/modules/circ/overdue.tt | 5 +-- > 2 files changed, 20 insertions(+), 20 deletions(-) > >diff --git a/circ/overdue.pl b/circ/overdue.pl >index 01a80d2..4fb046f 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -19,15 +19,13 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > use C4::Context; > use C4::Output; > use CGI qw(-oldstyle_urls -utf8); > use C4::Auth; > use C4::Branch; > use C4::Debug; >-use C4::Dates qw/format_date format_date_in_iso/; > use Text::CSV_XS; > use Koha::DateUtils; > use DateTime; >@@ -43,16 +41,15 @@ my $branchfilter = $input->param('branch') || ''; > my $homebranchfilter = $input->param('homebranch') || ''; > my $holdingbranchfilter = $input->param('holdingbranch') || ''; > my $op = $input->param('op') || ''; >-my $dateduefrom = format_date_in_iso($input->param( 'dateduefrom' )) || ''; >-my $datedueto = format_date_in_iso($input->param( 'datedueto' )) || ''; >-# FIXME This is a kludge to include times >-if ($datedueto) { >- $datedueto .= ' 23:59'; >+ >+my ($dateduefrom, $datedueto); >+if ( $dateduefrom = $input->param('dateduefrom') ) { >+ $dateduefrom = dt_from_string( $dateduefrom ); > } >-if ($dateduefrom) { >- $dateduefrom .= ' 00:00'; >+if ( $datedueto = $input->param('datedueto') ) { >+ $datedueto = dt_from_string( $datedueto )->set_hour(23)->set_minute(59); > } >-# kludge end >+ > my $isfiltered = $op =~ /apply/i && $op =~ /filter/i; > my $noreport = C4::Context->preference('FilterBeforeOverdueReport') && ! $isfiltered && $op ne "csv"; > >@@ -228,8 +225,8 @@ $template->param( > borname => $bornamefilter, > order => $order, > showall => $showall, >- dateduefrom => $input->param( 'dateduefrom' ) || '', >- datedueto => $input->param( 'datedueto' ) || '', >+ dateduefrom => $dateduefrom, >+ datedueto => $datedueto, > ); > > if ($noreport) { >@@ -307,8 +304,8 @@ if ($noreport) { > $strsth.=" AND borrowers.branchcode = '" . $branchfilter . "' " if $branchfilter; > $strsth.=" AND items.homebranch = '" . $homebranchfilter . "' " if $homebranchfilter; > $strsth.=" AND items.holdingbranch = '" . $holdingbranchfilter . "' " if $holdingbranchfilter; >- $strsth.=" AND date_due < '" . $datedueto . "' " if $datedueto; >- $strsth.=" AND date_due > '" . $dateduefrom . "' " if $dateduefrom; >+ $strsth.=" AND date_due >= ?" if $dateduefrom; >+ $strsth.=" AND date_due <= ?" if $datedueto; > # restrict patrons (borrowers) to those matching the patron attribute filter(s), if any > my $bnlist = $have_pattr_filter_data ? join(',',keys %borrowernumber_to_attributes) : ''; > $strsth =~ s/WHERE 1=1/WHERE 1=1 AND borrowers.borrowernumber IN ($bnlist)/ if $bnlist; >@@ -323,8 +320,10 @@ if ($noreport) { > ); > $template->param(sql=>$strsth); > my $sth=$dbh->prepare($strsth); >- #warn "overdue.pl : query string ".$strsth; >- $sth->execute(); >+ $sth->execute( >+ ($dateduefrom ? output_pref({ dt => $dateduefrom, dateformat => 'iso' }) : ()), >+ ($datedueto ? output_pref({ dt => $datedueto, dateformat => 'iso' }) : ()), >+ ); > > my @overduedata; > while (my $data = $sth->fetchrow_hashref) { >@@ -348,7 +347,7 @@ if ($noreport) { > barcode => $data->{barcode}, > cardnumber => $data->{cardnumber}, > itemnum => $data->{itemnumber}, >- issuedate => format_date($data->{issuedate}), >+ issuedate => output_pref({ dt => dt_from_string( $data->{issuedate} ), dateonly => 1 }), > borrowertitle => $data->{borrowertitle}, > surname => $data->{surname}, > firstname => $data->{firstname}, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >index c1aa428..4ebc7d2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >@@ -1,3 +1,4 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Circulation › Items overdue as of [% todaysdate %]</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -137,11 +138,11 @@ overdue as of [% todaysdate %][% IF ( isfiltered ) %] <span style="font-size:70% > <fieldset><legend>Date due:</legend> > <ol> > <li><label for="from">From:</label> >- <input type="text" id="from" name="dateduefrom" size="10" value="[% dateduefrom %]" class="datepickerfrom" /> >+ <input type="text" id="from" name="dateduefrom" size="10" value="[% dateduefrom | $KohaDates %]" class="datepickerfrom" /> > </li> > <li> > <label for="to">To:</label> >- <input type="text" id="to" name="datedueto" size="10" value="[% datedueto %]" class="datepickerto" /> >+ <input type="text" id="to" name="datedueto" size="10" value="[% datedueto | $KohaDates %]" class="datepickerto" /> > </li> > </ol></fieldset> > <ol> >-- >1.7.10.4
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 14916
:
42927
|
42928
|
43344
|
43375
|
43405
|
43567