Patch from Joe Atzberger to remove $Id$ and $Log$ from scripts
[koha.git] / reserve / renewscript.pl
1 #!/usr/bin/perl
2
3
4 #written 18/1/2000 by chris@katipo.co.nz
5 #script to renew items from the web
6
7
8 # Copyright 2000-2002 Katipo Communications
9 #
10 # This file is part of Koha.
11 #
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
15 # version.
16 #
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License along with
22 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 # Suite 330, Boston, MA  02111-1307 USA
24
25 use CGI;
26 use C4::Circulation;
27
28 my $input = new CGI;
29
30 #
31 # find items to renew, all items or a selection of items
32 #
33
34 my @data;
35 if ($input->param('renew_all')) {
36     @data = $input->param('all_items[]');
37 }
38 else {
39     @data = $input->param('items[]');
40 }
41 my $branch=$input->param('branch');
42 #
43 # renew items
44 #
45 my $cardnumber = $input->param("cardnumber");
46 my $borrowernumber = $input->param("borrowernumber");
47
48 foreach my $itemno (@data) {
49     #check status before renewing issue
50 #    warn "CanBookbeRenewed";
51     if (CanBookBeRenewed($borrowernumber,$itemno)){
52 #       warn "$itemno can be renewed for $borrowernumber";
53         AddRenewal($borrowernumber,$itemno,$branch);
54 #       warn "renewal added";
55 #    }else {
56 #       warn "cannot renew";
57         }
58 }
59
60 #
61 # redirection to the referrer page
62 #
63 if ($input->param('destination') eq "circ"){
64     print $input->redirect(
65         '/cgi-bin/koha/circ/circulation.pl?findborrower='.$cardnumber
66     );
67 }
68 else {
69     print $input->redirect(
70         '/cgi-bin/koha/members/moremember.pl?borrowernumber='.$borrowernumber
71     );
72 }