View | Details | Raw Unified | Return to bug 14916
Collapse All | Expand All

(-)a/circ/overdue.pl (-18 / +17 lines)
Lines 19-33 Link Here
19
# You should have received a copy of the GNU General Public License
19
# You should have received a copy of the GNU General Public License
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
21
22
use strict;
22
use Modern::Perl;
23
use warnings;
24
use C4::Context;
23
use C4::Context;
25
use C4::Output;
24
use C4::Output;
26
use CGI qw(-oldstyle_urls -utf8);
25
use CGI qw(-oldstyle_urls -utf8);
27
use C4::Auth;
26
use C4::Auth;
28
use C4::Branch;
27
use C4::Branch;
29
use C4::Debug;
28
use C4::Debug;
30
use C4::Dates qw/format_date format_date_in_iso/;
31
use Text::CSV_XS;
29
use Text::CSV_XS;
32
use Koha::DateUtils;
30
use Koha::DateUtils;
33
use DateTime;
31
use DateTime;
Lines 43-58 my $branchfilter = $input->param('branch') || ''; Link Here
43
my $homebranchfilter    = $input->param('homebranch') || '';
41
my $homebranchfilter    = $input->param('homebranch') || '';
44
my $holdingbranchfilter = $input->param('holdingbranch') || '';
42
my $holdingbranchfilter = $input->param('holdingbranch') || '';
45
my $op              = $input->param('op') || '';
43
my $op              = $input->param('op') || '';
46
my $dateduefrom = format_date_in_iso($input->param( 'dateduefrom' )) || '';
44
47
my $datedueto   = format_date_in_iso($input->param( 'datedueto' )) || '';
45
my ($dateduefrom, $datedueto);
48
# FIXME This is a kludge to include times
46
if ( $dateduefrom = $input->param('dateduefrom') ) {
49
if ($datedueto) {
47
    $dateduefrom = dt_from_string( $dateduefrom );
50
    $datedueto .= ' 23:59';
51
}
48
}
52
if ($dateduefrom) {
49
if ( $datedueto = $input->param('datedueto') ) {
53
    $dateduefrom .= ' 00:00';
50
    $datedueto = dt_from_string( $datedueto )->set_hour(23)->set_minute(59);
54
}
51
}
55
# kludge end
52
56
my $isfiltered      = $op =~ /apply/i && $op =~ /filter/i;
53
my $isfiltered      = $op =~ /apply/i && $op =~ /filter/i;
57
my $noreport        = C4::Context->preference('FilterBeforeOverdueReport') && ! $isfiltered && $op ne "csv";
54
my $noreport        = C4::Context->preference('FilterBeforeOverdueReport') && ! $isfiltered && $op ne "csv";
58
55
Lines 228-235 $template->param( Link Here
228
    borname => $bornamefilter,
225
    borname => $bornamefilter,
229
    order => $order,
226
    order => $order,
230
    showall => $showall,
227
    showall => $showall,
231
    dateduefrom => $input->param( 'dateduefrom' ) || '',
228
    dateduefrom => $dateduefrom,
232
    datedueto   => $input->param( 'datedueto' ) || '',
229
    datedueto   => $datedueto,
233
);
230
);
234
231
235
if ($noreport) {
232
if ($noreport) {
Lines 307-314 if ($noreport) { Link Here
307
    $strsth.=" AND borrowers.branchcode   = '" . $branchfilter   . "' " if $branchfilter;
304
    $strsth.=" AND borrowers.branchcode   = '" . $branchfilter   . "' " if $branchfilter;
308
    $strsth.=" AND items.homebranch       = '" . $homebranchfilter . "' " if $homebranchfilter;
305
    $strsth.=" AND items.homebranch       = '" . $homebranchfilter . "' " if $homebranchfilter;
309
    $strsth.=" AND items.holdingbranch    = '" . $holdingbranchfilter . "' " if $holdingbranchfilter;
306
    $strsth.=" AND items.holdingbranch    = '" . $holdingbranchfilter . "' " if $holdingbranchfilter;
310
    $strsth.=" AND date_due < '" . $datedueto . "' "  if $datedueto;
307
    $strsth.=" AND date_due >= ?" if $dateduefrom;
311
    $strsth.=" AND date_due > '" . $dateduefrom . "' " if $dateduefrom;
308
    $strsth.=" AND date_due <= ?" if $datedueto;
312
    # restrict patrons (borrowers) to those matching the patron attribute filter(s), if any
309
    # restrict patrons (borrowers) to those matching the patron attribute filter(s), if any
313
    my $bnlist = $have_pattr_filter_data ? join(',',keys %borrowernumber_to_attributes) : '';
310
    my $bnlist = $have_pattr_filter_data ? join(',',keys %borrowernumber_to_attributes) : '';
314
    $strsth =~ s/WHERE 1=1/WHERE 1=1 AND borrowers.borrowernumber IN ($bnlist)/ if $bnlist;
311
    $strsth =~ s/WHERE 1=1/WHERE 1=1 AND borrowers.borrowernumber IN ($bnlist)/ if $bnlist;
Lines 323-330 if ($noreport) { Link Here
323
    );
320
    );
324
    $template->param(sql=>$strsth);
321
    $template->param(sql=>$strsth);
325
    my $sth=$dbh->prepare($strsth);
322
    my $sth=$dbh->prepare($strsth);
326
    #warn "overdue.pl : query string ".$strsth;
323
    $sth->execute(
327
    $sth->execute();
324
        ($dateduefrom ? output_pref({ dt => $dateduefrom, dateformat => 'iso' }) : ()),
325
        ($datedueto ? output_pref({ dt => $datedueto, dateformat => 'iso' }) : ()),
326
    );
328
327
329
    my @overduedata;
328
    my @overduedata;
330
    while (my $data = $sth->fetchrow_hashref) {
329
    while (my $data = $sth->fetchrow_hashref) {
Lines 348-354 if ($noreport) { Link Here
348
            barcode                => $data->{barcode},
347
            barcode                => $data->{barcode},
349
            cardnumber             => $data->{cardnumber},
348
            cardnumber             => $data->{cardnumber},
350
            itemnum                => $data->{itemnumber},
349
            itemnum                => $data->{itemnumber},
351
            issuedate              => format_date($data->{issuedate}),
350
            issuedate              => output_pref({ dt => dt_from_string( $data->{issuedate} ), dateonly => 1 }),
352
            borrowertitle          => $data->{borrowertitle},
351
            borrowertitle          => $data->{borrowertitle},
353
            surname                => $data->{surname},
352
            surname                => $data->{surname},
354
            firstname              => $data->{firstname},
353
            firstname              => $data->{firstname},
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt (-3 / +3 lines)
Lines 1-3 Link Here
1
[% USE KohaDates %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Circulation &rsaquo; Items overdue as of [% todaysdate %]</title>
3
<title>Koha &rsaquo; Circulation &rsaquo; Items overdue as of [% todaysdate %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 137-147 overdue as of [% todaysdate %][% IF ( isfiltered ) %] <span style="font-size:70% Link Here
137
	<fieldset><legend>Date due:</legend>
138
	<fieldset><legend>Date due:</legend>
138
	<ol>
139
	<ol>
139
    <li><label for="from">From:</label>
140
    <li><label for="from">From:</label>
140
    <input type="text" id="from" name="dateduefrom" size="10" value="[% dateduefrom %]" class="datepickerfrom" />
141
    <input type="text" id="from" name="dateduefrom" size="10" value="[% dateduefrom | $KohaDates %]" class="datepickerfrom" />
141
	</li>
142
	</li>
142
	<li>
143
	<li>
143
    <label for="to">To:</label>
144
    <label for="to">To:</label>
144
    <input type="text" id="to" name="datedueto" size="10" value="[% datedueto %]" class="datepickerto" />
145
    <input type="text" id="to" name="datedueto" size="10" value="[% datedueto | $KohaDates %]" class="datepickerto" />
145
    </li>
146
    </li>
146
    </ol></fieldset>
147
    </ol></fieldset>
147
    <ol>
148
    <ol>
148
- 

Return to bug 14916