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

(-)a/circ/pendingreserves.pl (-17 / +21 lines)
Lines 27-41 use strict; Link Here
27
#use warnings; FIXME - Bug 2505
27
#use warnings; FIXME - Bug 2505
28
28
29
use constant TWO_DAYS => 2;
29
use constant TWO_DAYS => 2;
30
use constant TWO_DAYS_AGO => -2;
31
30
32
use C4::Context;
31
use C4::Context;
33
use C4::Output;
32
use C4::Output;
34
use CGI qw ( -utf8 );
33
use CGI qw ( -utf8 );
35
use C4::Auth;
34
use C4::Auth;
36
use C4::Dates qw/format_date format_date_in_iso/;
37
use C4::Debug;
35
use C4::Debug;
38
use Date::Calc qw/Today Add_Delta_YMD/;
36
use Koha::DateUtils;
37
use DateTime::Duration;
39
38
40
my $input = new CGI;
39
my $input = new CGI;
41
my $startdate=$input->param('from');
40
my $startdate=$input->param('from');
Lines 68-106 my $biblionumber; Link Here
68
my $title;
67
my $title;
69
my $author;
68
my $author;
70
69
71
my ( $year, $month, $day ) = Today();
70
my $today = dt_from_string;
72
my $todaysdate     = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day);
73
$startdate =~ s/^\s+//;
71
$startdate =~ s/^\s+//;
74
$startdate =~ s/\s+$//;
72
$startdate =~ s/\s+$//;
75
$enddate =~ s/^\s+//;
73
$enddate =~ s/^\s+//;
76
$enddate =~ s/\s+$//;
74
$enddate =~ s/\s+$//;
77
75
78
if (!defined($startdate) or $startdate eq "") {
76
if ( $startdate ) {
77
    $startdate = eval{dt_from_string( $startdate )};
78
}
79
unless ( $startdate ){
79
    # changed from delivered range of 10 years-yesterday to 2 days ago-today
80
    # changed from delivered range of 10 years-yesterday to 2 days ago-today
80
    # Find two days ago for the default shelf pull start date, unless HoldsToPullStartDate sys pref is set.
81
    # Find two days ago for the default shelf pull start date, unless HoldsToPullStartDate sys pref is set.
81
    my $pastdate= sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, -C4::Context->preference('HoldsToPullStartDate')||TWO_DAYS_AGO ));
82
    $startdate = $today - DateTime::Duration->new( days => C4::Context->preference('HoldsToPullStartDate') || 2 );
82
    $startdate = format_date($pastdate);
83
}
83
}
84
84
85
if (!defined($enddate) or $enddate eq "") {
85
if ( $enddate ) {
86
    $enddate = eval{dt_from_string( $enddate )};
87
}
88
unless ( $enddate ) {
86
    #similarly: calculate end date with ConfirmFutureHolds (days)
89
    #similarly: calculate end date with ConfirmFutureHolds (days)
87
    my $d=sprintf("%-04.4d-%-02.2d-%02.2d", Add_Delta_YMD($year, $month, $day, 0, 0, C4::Context->preference('ConfirmFutureHolds')||0 ));
90
    $enddate = $today - DateTime::Duration->new( days => C4::Context->preference('ConfirmFutureHolds') || 0 );
88
    $enddate = format_date($d);
89
}
91
}
90
92
91
my @reservedata;
93
my @reservedata;
92
if ( $run_report ) {
94
if ( $run_report ) {
93
    my $dbh    = C4::Context->dbh;
95
    my $dbh    = C4::Context->dbh;
94
    my $sqldatewhere = "";
96
    my $sqldatewhere = "";
95
    $debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate);
97
    my $startdate_iso = output_pref({ dt => $startdate, dateformat => 'iso', dateonly => 1 });
98
    my $enddate_iso   = output_pref({ dt => $enddate, dateformat => 'iso', dateonly => 1 });
99
    $debug and warn $startdate_iso. "\n" . $enddate_iso;
96
    my @query_params = ();
100
    my @query_params = ();
97
    if ($startdate) {
101
    if ($startdate_iso) {
98
        $sqldatewhere .= " AND reservedate >= ?";
102
        $sqldatewhere .= " AND reservedate >= ?";
99
        push @query_params, format_date_in_iso($startdate);
103
        push @query_params, $startdate_iso;
100
    }
104
    }
101
    if ($enddate) {
105
    if ($enddate_iso) {
102
        $sqldatewhere .= " AND reservedate <= ?";
106
        $sqldatewhere .= " AND reservedate <= ?";
103
        push @query_params, format_date_in_iso($enddate);
107
        push @query_params, $enddate_iso;
104
    }
108
    }
105
109
106
    my $strsth =
110
    my $strsth =
Lines 196-202 if ( $run_report ) { Link Here
196
}
200
}
197
201
198
$template->param(
202
$template->param(
199
    todaysdate          => $todaysdate,
203
    todaysdate          => $today,
200
    from                => $startdate,
204
    from                => $startdate,
201
    to                  => $enddate,
205
    to                  => $enddate,
202
    run_report          => $run_report,
206
    run_report          => $run_report,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt (-4 / +3 lines)
Lines 82-88 $(document).ready(function() { Link Here
82
    <div id="yui-main">
82
    <div id="yui-main">
83
    <div class="yui-b">
83
    <div class="yui-b">
84
84
85
<h2>Holds to pull[% IF ( run_report ) %] placed between [% from %] and [% to %][% END %]</h2>
85
<h2>Holds to pull[% IF ( run_report ) %] placed between [% from | $KohaDates %] and [% to | $KohaDates %][% END %]</h2>
86
[% IF ( run_report ) %]
86
[% IF ( run_report ) %]
87
<h3>Reported on [% todaysdate | $KohaDates %]</h3>
87
<h3>Reported on [% todaysdate | $KohaDates %]</h3>
88
<p>The following holds have not been filled. Please retrieve them and check them in.</p>
88
<p>The following holds have not been filled. Please retrieve them and check them in.</p>
Lines 171-182 $(document).ready(function() { Link Here
171
<label for="from">
171
<label for="from">
172
    Start date:
172
    Start date:
173
</label>
173
</label>
174
<input type="text" size="10" id="from" name="from" value="[% from %]" class="datepickerfrom" />
174
<input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="datepickerfrom" />
175
</li>
175
</li>
176
<li><label for="to">
176
<li><label for="to">
177
    End date:
177
    End date:
178
</label>
178
</label>
179
<input type="text" size="10" id="to" name="to" value="[% to %]" class="datepickerto" />
179
<input type="text" size="10" id="to" name="to" value="[% to | $KohaDates %]" class="datepickerto" />
180
</li>
180
</li>
181
</ol>
181
</ol>
182
<p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to [% IF ( HoldsToPullEndDate ) %][% HoldsToPullEndDate %] days ahead[% ELSE %]today[% END %], set other date ranges as needed. )</i></p>
182
<p><i>(Inclusive, default is [% HoldsToPullStartDate %] days ago to [% IF ( HoldsToPullEndDate ) %][% HoldsToPullEndDate %] days ahead[% ELSE %]today[% END %], set other date ranges as needed. )</i></p>
183
- 

Return to bug 14928