From: Will Stokes <[email protected]>
Signed-off-by: Chris Cormack <[email protected]>
---
circ/pendingreserves.pl | 26 ++++++++-
.../prog/en/modules/circ/pendingreserves.tmpl | 64 ++++++++++++++++++--
2 files changed, 83 insertions(+), 7 deletions(-)
diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl
index ea4d61b..512453f 100755
--- a/circ/pendingreserves.pl
+++ b/circ/pendingreserves.pl
@@ -37,6 +37,7 @@ my $order = $input->param('order');
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
@@ -86,9 +87,10 @@ if (!defined($enddate) or $enddate eq "") {
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) {
@@ -100,6 +102,12 @@ if ( $run_report ) {
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") {
@@ -206,6 +214,18 @@ if ( $run_report ) {
$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/;
@@ -260,6 +280,10 @@ $template->param(
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(),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tmpl
b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tmpl
index 6e1145c..28efee4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tmpl
@@ -49,7 +49,8 @@ $.tablesorter.addParser({
<div class="searchresults">
<!-- TMPL_IF NAME="reserveloop" -->
<table id="holdst">
- <thead><tr>
+ <thead>
+ <tr>
<th>
Pull This Many Items
</th>
@@ -81,10 +82,35 @@ $.tablesorter.addParser({
<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>
@@ -125,7 +151,33 @@ $.tablesorter.addParser({
<!-- 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>
--
1.6.3.3
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches