my $startdate=$input->param('from');
my $enddate=$input->param('to');
my $run_report=$input->param('run_report');
+my $report_page=$input->param('report_page');
my $theme = $input->param('theme'); # only used if allowthemeoverride is set
my @reservedata;
+my ($prev_results, $next_results, $next_or_previous) = (0,0,0);
if ( $run_report ) {
my $dbh = C4::Context->dbh;
- my ($sqlorderby, $sqldatewhere) = ("","");
+ my ($sqlorderby, $sqldatewhere, $sqllimitoffset) = ("","","");
$debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate);
my @query_params = ();
if ($startdate) {
push @query_params, format_date_in_iso($enddate);
}
+ $sqllimitoffset = " LIMIT 251";
+ if ($report_page) {
+ $sqllimitoffset .= " OFFSET=?";
+ push @query_params, ($report_page * 250);
+ }
+
if ($order eq "biblio") {
$sqlorderby = " ORDER BY biblio.title ";
} elsif ($order eq "itype") {
$sth->finish;
+ # Next Page?
+ if ($report_page > 0) {
+ $prev_results = $report_page - 1;
+ }
+ if ( scalar(@reservedata) > 250 ) {
+ $next_results = $report_page + 1;
+ pop(@reservedata); # .. we retrieved 251 results
+ }
+ if ($prev_results || $next_results) {
+ $next_or_previous = 1;
+ }
+
# *** I doubt any of this is needed now with the above fixes *** -d.u.
#$strsth=~ s/AND reserves.itemnumber is NULL/AND reserves.itemnumber is NOT NULL/;
from => $startdate,
to => $enddate,
run_report => $run_report,
+ report_page => $report_page,
+ prev_results => $prev_results,
+ next_results => $next_results,
+ next_or_previous => $next_or_previous,
reserveloop => \@reservedata,
"BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
<div class="searchresults">
<!-- TMPL_IF NAME="reserveloop" -->
<table id="holdst">
- <thead><tr>
+ <thead>
+ <tr>
<th>
Pull This Many Items
</th>
<th >Earliest Hold Date
<a href="/cgi-bin/koha/circ/pendingreserves.pl?order=date&from=<!-- TMPL_VAR NAME="from" -->&to=<!-- TMPL_VAR NAME="to" -->">Sort</a>
</th>
-
- </tr></thead>
-
- <tbody> <!-- TMPL_LOOP NAME="reserveloop" -->
+ </tr>
+ </thead>
+ <tbody>
+ <!-- TMPL_IF NAME="next_or_previous" -->
+ <tr>
+ <td colspan="3" align="left">
+ <!-- TMPL_IF NAME="prev_results" -->
+ <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="POST">
+ <input type="hidden" name="from" value="<!-- TMPL_VAR NAME="from" -->">
+ <input type="hidden" name="to" value="<!-- TMPL_VAR NAME="to" -->">
+ <input type="hidden" name="report_page" value="<!-- TMPL_VAR NAME="prev_results" -->">
+ <input type="submit" name="run_report" value="< Prev">
+ </form>
+ <!-- /TMPL_IF -->
+ </td>
+ <td colspan="3"></td>
+ <td colspan="3" align="right">
+ <!-- TMPL_IF NAME="next_results" -->
+ <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="POST">
+ <input type="hidden" name="from" value="<!-- TMPL_VAR NAME="from" -->">
+ <input type="hidden" name="to" value="<!-- TMPL_VAR NAME="to" -->">
+ <input type="hidden" name="report_page" value="<!-- TMPL_VAR NAME="next_results" -->">
+ <input type="submit" name="run_report" value="Next >">
+ </form>
+ <!-- /TMPL_IF -->
+ </td>
+ </tr>
+ <!-- /TMPL_IF -->
+ <!-- TMPL_LOOP NAME="reserveloop" -->
<tr>
<!-- TMPL_IF name="borrowernumber" -->
<td><p><b><!-- TMPL_VAR NAME="pullcount" --></b></p></td>
<!-- TMPL_IF NAME="statusw" --><p>Waiting</p><!-- /TMPL_IF --><!-- TMPL_IF NAME="statusf" --><p>Fullfilled</p><!-- /TMPL_IF -->
</td>
</tr>
- <!-- /TMPL_LOOP --></tbody>
+ <!-- /TMPL_LOOP -->
+ <!-- TMPL_IF NAME="next_or_previous" -->
+ <tr>
+ <td colspan="3" align="left">
+ <!-- TMPL_IF NAME="prev_results" -->
+ <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="POST">
+ <input type="hidden" name="from" value="<!-- TMPL_VAR NAME="from" -->">
+ <input type="hidden" name="to" value="<!-- TMPL_VAR NAME="to" -->">
+ <input type="hidden" name="report_page" value="<!-- TMPL_VAR NAME="prev_results" -->">
+ <input type="submit" name="run_report" value="< Prev">
+ </form>
+ <!-- /TMPL_IF -->
+ </td>
+ <td colspan="3"></td>
+ <td colspan="3" align="right">
+ <!-- TMPL_IF NAME="next_results" -->
+ <form action="/cgi-bin/koha/circ/pendingreserves.pl" method="POST">
+ <input type="hidden" name="from" value="<!-- TMPL_VAR NAME="from" -->">
+ <input type="hidden" name="to" value="<!-- TMPL_VAR NAME="to" -->">
+ <input type="hidden" name="report_page" value="<!-- TMPL_VAR NAME="next_results" -->">
+ <input type="submit" name="run_report" value="Next >">
+ </form>
+ <!-- /TMPL_IF -->
+ </td>
+ </tr>
+ <!-- /TMPL_IF -->
+ </tbody>
</table>
<!-- TMPL_ELSE -->
<b>No items found.</b>