removing useless package
[koha.git] / placerequest.pl
1 #!/usr/bin/perl
2
3 #script to place reserves/requests
4 #writen 2/1/00 by chris@katipo.oc.nz
5
6
7 # Copyright 2000-2002 Katipo Communications
8 #
9 # This file is part of Koha.
10 #
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 #
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA  02111-1307 USA
23
24 use strict;
25 #use DBI;
26 use C4::Biblio;
27 use CGI;
28 use C4::Output;
29 use C4::Reserves2;
30 use C4::Members;
31
32 my $input = new CGI;
33 #print $input->header;
34
35 my @bibitems=$input->param('biblioitem');
36 my @reqbib=$input->param('reqbib');
37 my $biblionumber=$input->param('biblionumber');
38 my $borrower=$input->param('member');
39 my $notes=$input->param('notes');
40 my $branch=$input->param('pickup');
41 my @rank=$input->param('rank-request');
42 my $type=$input->param('type');
43 my $title=$input->param('title');
44 my $bornum=borrdata($borrower,'');
45 if ($type eq 'str8' && $bornum ne ''){
46         my $count=@bibitems;
47         @bibitems=sort @bibitems;
48         my $i2=1;
49         my @realbi;
50         $realbi[0]=$bibitems[0];
51         for (my $i=1;$i<$count;$i++) {
52                 my $i3=$i2-1;
53                 if ($realbi[$i3] ne $bibitems[$i]) {
54                         $realbi[$i2]=$bibitems[$i];
55                         $i2++;
56                 }
57         }
58         my $env;
59         my $const;
60         if ($input->param('request') eq 'any'){
61         $const='a';
62         CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblionumber,$const,\@realbi,$rank[0],$notes,$title);
63         } elsif ($reqbib[0] ne ''){
64         $const='o';
65         CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblionumber,$const,\@reqbib,$rank[0],$notes,$title);
66         } else {
67         CreateReserve(\$env,$branch,$bornum->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$notes,$title);
68         }
69         
70         print $input->redirect("request.pl?biblionumber=$biblionumber");
71 } elsif ($bornum eq ''){
72         print $input->header();
73         print "Invalid card number please try again";
74         print $input->Dump;
75 }