Koha/opac/opac-renew.pl
Chris Cormack 211399668a Bug 5618: Multiple renewals in the opac
Enables logged-in OPAC patrons to renew multiple items at once using checkboxes.

Errors are now handled better (for example, when item is on reserve)

Sponsored by Los Gatos Public Library

Squashed commit of the following:

commit 020d9904ddb22af238c8a90c1f7447ead5a6d0e7
Author: Chris Cormack <chrisc@catalyst.net.nz>
Date:   Thu Jan 20 08:57:01 2011 +1300

    Bug 5618: typo fix

commit 147cfd91dbe88fd58c5d404db9bf06a21310e2ef
Author: Chris Cormack <chrisc@catalyst.net.nz>
Date:   Thu Jan 20 08:47:39 2011 +1300

    Bug 5618: Adding better error handling for reserves, and always redirecting instead of exploding

commit 2dfb6c687d0d38c240e22d41f2aef6e3a9e53f02
Author: Chris Cormack <chrisc@koha.(none)>
Date:   Fri Jan 14 15:39:20 2011 +1300

    Bug 5618: Is mostly working now, needs some prettying up

commit f8d260a4dcde144c9ed487521a79ee687ff8feb3
Author: Chris Cormack <chrisc@catalyst.net.nz>
Date:   Fri Jan 14 15:03:45 2011 +1300

    bug 5618: Initial commit to set up checkboxes for choosing multiple items

Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-01-24 07:25:54 +13:00

59 lines
1.8 KiB
Perl
Executable file

#!/usr/bin/perl
#written 18/1/2000 by chris@katipo.co.nz
# adapted for use in the hlt opac by finlay@katipo.co.nz 29/11/2002
# script to renew items from the web
# Parts Copyright 2010 Catalyst IT
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# 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
use strict;
use warnings;
use CGI;
use C4::Circulation;
use C4::Auth;
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "opac-user.tmpl",
query => $query,
type => "opac",
authnotrequired => 0,
flagsrequired => { borrow => 1 },
debug => 1,
}
);
my @items = $query->param('item');
$borrowernumber = $query->param('borrowernumber') || $query->param('bornum');
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
my $errorstring='';
for my $itemnumber ( @items ) {
my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
if ( $status == 1 && $opacrenew == 1 ) {
AddRenewal( $borrowernumber, $itemnumber );
}
else {
$errorstring .= $error ."|";
}
}
print $query->redirect("/cgi-bin/koha/opac-user.pl?renew_error=$errorstring");