Adding toggle of subscriptionhistory information
[koha.git] / opac / opac-renew.pl
blob205f48a227576bd02b51e3e23c42a3667f45404a
1 #!/usr/bin/perl
3 #written 18/1/2000 by chris@katipo.co.nz
4 # adapted for use in the hlt opac by finlay@katipo.co.nz 29/11/2002
5 #script to renew items from the web
7 use strict;
8 use warnings;
10 use CGI;
11 use C4::Circulation;
12 use C4::Auth;
14 my $query = new CGI;
16 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
18 template_name => "opac-user.tmpl",
19 query => $query,
20 type => "opac",
21 authnotrequired => 0,
22 flagsrequired => { borrow => 1 },
23 debug => 1,
25 );
26 my @items = $query->param('item');
27 $borrowernumber = $query->param('borrowernumber') || $query->param('bornum');
28 my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
30 for my $itemnumber ( @items ) {
31 my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
32 if ( $status == 1 && $opacrenew == 1 ) {
33 AddRenewal( $borrowernumber, $itemnumber );
36 # FIXME: else return ERROR to user!!
38 if ( $query->param('from') eq 'opac_user' ) {
39 print $query->redirect("/cgi-bin/koha/opac-user.pl");
41 # FIXME: ELSE WHAT? No response at all. Not very robust.