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