X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-renew.pl;h=68abed04a82c493ed73f804cf24a2b06b36fd232;hb=ef8171ba425f766b67d9e139194b6a8d570e301e;hp=195e8274fe87e633fcf30a9957c99f4a208cfad3;hpb=c13c16bf9940cd87e869a4fc40f2947427542018;p=srvgit diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl index 195e8274fe..68abed04a8 100755 --- a/opac/opac-renew.pl +++ b/opac/opac-renew.pl @@ -2,7 +2,27 @@ #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 +# 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., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +use strict; +use warnings; use CGI; use C4::Circulation; @@ -20,16 +40,20 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( debug => 1, } ); -my $itemnumber = $query->param('item'); -my $borrowernumber = $query->param('borrowernumber') || $query->param('bornum'); +my @items = $query->param('item'); +$borrowernumber = $query->param('borrowernumber') || $query->param('bornum'); +my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); -my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber ); -if ( $status == 1 ) { - AddRenewal( $borrowernumber, $itemnumber ); +my $errorstring=''; +for my $itemnumber ( @items ) { + my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber ); + if ( $status == 1 && $opacrenew == 1 ) { + 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"); -} -# FIXME: ELSE WHAT? No response at all. Not very robust. +print $query->redirect("/cgi-bin/koha/opac-user.pl?renew_error=$errorstring"); +