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>
This commit is contained in:
parent
4656f32305
commit
211399668a
2 changed files with 34 additions and 7 deletions
|
@ -192,6 +192,9 @@ $.tablesorter.addParser({
|
||||||
<!-- /TMPL_IF -->
|
<!-- /TMPL_IF -->
|
||||||
|
|
||||||
<div id="opac-user-checkouts"><!-- TMPL_IF NAME="issues_count" -->
|
<div id="opac-user-checkouts"><!-- TMPL_IF NAME="issues_count" -->
|
||||||
|
<form action="/cgi-bin/koha/opac-renew.pl" method="post">
|
||||||
|
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->">
|
||||||
|
<input type="hidden" name="from" value="opac_user" />
|
||||||
<table id="checkoutst">
|
<table id="checkoutst">
|
||||||
<caption><!-- TMPL_VAR NAME="issues_count" --> Items Checked Out</caption>
|
<caption><!-- TMPL_VAR NAME="issues_count" --> Items Checked Out</caption>
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
|
@ -246,7 +249,7 @@ $.tablesorter.addParser({
|
||||||
<!-- /TMPL_IF -->
|
<!-- /TMPL_IF -->
|
||||||
<!-- TMPL_IF name="OpacRenewalAllowed" -->
|
<!-- TMPL_IF name="OpacRenewalAllowed" -->
|
||||||
<!-- TMPL_UNLESS name="patron_flagged" -->
|
<!-- TMPL_UNLESS name="patron_flagged" -->
|
||||||
<td><!-- TMPL_IF NAME="status" --><a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=<!-- TMPL_VAR NAME="itemnumber" -->&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Renew</a> <span class="renewals">(<!-- TMPL_VAR NAME="renewsleft" --> of <!-- TMPL_VAR NAME="renewsallowed" --> renewals remaining)</span>
|
<td><!-- TMPL_IF NAME="status" --><input type="checkbox" name="item" value="<!-- TMPL_VAR NAME="itemnumber"-->"/><a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&item=<!-- TMPL_VAR NAME="itemnumber" -->&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Renew</a> <span class="renewals">(<!-- TMPL_VAR NAME="renewsleft" --> of <!-- TMPL_VAR NAME="renewsallowed" --> renewals remaining)</span>
|
||||||
<!-- TMPL_ELSE -->
|
<!-- TMPL_ELSE -->
|
||||||
Not renewable<!-- TMPL_IF NAME="too_many" --> <span class="renewals">(<!-- TMPL_VAR NAME="renewsleft" --> of <!-- TMPL_VAR NAME="renewsallowed" --> renewals remaining)</span><!-- TMPL_ELSE --><!-- TMPL_IF NAME="on_reserve" --> <span class="renewals">(On hold)</span><!-- /TMPL_IF --><!-- /TMPL_IF -->
|
Not renewable<!-- TMPL_IF NAME="too_many" --> <span class="renewals">(<!-- TMPL_VAR NAME="renewsleft" --> of <!-- TMPL_VAR NAME="renewsallowed" --> renewals remaining)</span><!-- TMPL_ELSE --><!-- TMPL_IF NAME="on_reserve" --> <span class="renewals">(On hold)</span><!-- /TMPL_IF --><!-- /TMPL_IF -->
|
||||||
<!-- /TMPL_IF --></td>
|
<!-- /TMPL_IF --></td>
|
||||||
|
@ -258,7 +261,13 @@ $.tablesorter.addParser({
|
||||||
</tr>
|
</tr>
|
||||||
<!-- /TMPL_LOOP --></tbody>
|
<!-- /TMPL_LOOP --></tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- TMPL_IF name="OpacRenewalAllowed" -->
|
<!-- TMPL_IF name="OpacRenewalAllowed" -->
|
||||||
|
<input type="submit" value="Renew Selected" />
|
||||||
|
<!-- /TMPL_IF -->
|
||||||
|
</form>
|
||||||
|
<!-- TMPL_IF name="OpacRenewalAllowed" -->
|
||||||
|
|
||||||
<form action="/cgi-bin/koha/opac-renew.pl" method="post">
|
<form action="/cgi-bin/koha/opac-renew.pl" method="post">
|
||||||
<input type="hidden" name="from" value="opac_user" />
|
<input type="hidden" name="from" value="opac_user" />
|
||||||
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
|
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
|
||||||
|
|
|
@ -2,7 +2,24 @@
|
||||||
|
|
||||||
#written 18/1/2000 by chris@katipo.co.nz
|
#written 18/1/2000 by chris@katipo.co.nz
|
||||||
# adapted for use in the hlt opac by finlay@katipo.co.nz 29/11/2002
|
# adapted for use in the hlt opac by finlay@katipo.co.nz 29/11/2002
|
||||||
#script to renew items from the web
|
# 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 strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
@ -27,15 +44,16 @@ my @items = $query->param('item');
|
||||||
$borrowernumber = $query->param('borrowernumber') || $query->param('bornum');
|
$borrowernumber = $query->param('borrowernumber') || $query->param('bornum');
|
||||||
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
|
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
|
||||||
|
|
||||||
|
my $errorstring='';
|
||||||
for my $itemnumber ( @items ) {
|
for my $itemnumber ( @items ) {
|
||||||
my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
|
my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
|
||||||
if ( $status == 1 && $opacrenew == 1 ) {
|
if ( $status == 1 && $opacrenew == 1 ) {
|
||||||
AddRenewal( $borrowernumber, $itemnumber );
|
AddRenewal( $borrowernumber, $itemnumber );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$errorstring .= $error ."|";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# FIXME: else return ERROR to user!!
|
|
||||||
|
|
||||||
if ( $query->param('from') eq 'opac_user' ) {
|
print $query->redirect("/cgi-bin/koha/opac-user.pl?renew_error=$errorstring");
|
||||||
print $query->redirect("/cgi-bin/koha/opac-user.pl");
|
|
||||||
}
|
|
||||||
# FIXME: ELSE WHAT? No response at all. Not very robust.
|
|
||||||
|
|
Loading…
Reference in a new issue