X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-modrequest.pl;h=05b01a836ae81eb0fbd92dce12e6351436f57020;hb=9d6d641d1f8b77271800f43bc027b651f9aea52b;hp=bada04da9450fd0af8e7c8578e646d5c450b3481;hpb=1922efff856ff27fd0fddc13898ab968a7c3bc15;p=srvgit diff --git a/opac/opac-modrequest.pl b/opac/opac-modrequest.pl index bada04da94..05b01a836a 100755 --- a/opac/opac-modrequest.pl +++ b/opac/opac-modrequest.pl @@ -9,40 +9,43 @@ # # 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 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 3 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. +# 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 +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; -use CGI; +use CGI qw ( -utf8 ); use C4::Output; -use C4::Reserves; -use C4::Auth; -my $query = new CGI; +use C4::Reserves qw( CanReserveBeCanceledFromOpac ); +use C4::Auth qw( get_template_and_user ); +use Koha::Holds; +my $query = CGI->new; + my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { - template_name => "opac-account.tmpl", + template_name => "opac-account.tt", query => $query, type => "opac", - authnotrequired => 0, - flagsrequired => { borrow => 1 }, - debug => 1, } ); -my $biblionumber = $query->param('biblionumber'); -if ($biblionumber and $borrowernumber) { - CancelReserve($biblionumber, '', $borrowernumber); +my $reserve_id = $query->param('reserve_id'); + +if ($reserve_id && $borrowernumber) { + if ( CanReserveBeCanceledFromOpac($reserve_id, $borrowernumber) ) { + my $hold = Koha::Holds->find( $reserve_id ); + $hold->cancel if $hold; + } } + print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds");