# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Modification by D.Ulm, actually works (as long as indep. branches not turned on)
# Someone let me know what indep. branches is supposed to do and I'll make that part work too
# The reserve pull lists *works* as long as not for indepencdant branches, I can fix!
use strict;
+#use warnings; FIXME - Bug 2505
use C4::Context;
use C4::Output;
use CGI;
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(),