Totally rewrote CalcReserveCharge. It now gets the reservecharge from the categoryite...
[koha.git] / insertidata.pl
1 #!/usr/bin/perl
2
3 #script to enter borrower data into the data base
4 #needs to be moved into a perl module
5 # written 9/11/99 by chris@katipo.co.nz
6
7 use CGI;
8 use C4::Database;
9 use C4::Input;
10 use Date::Manip;
11 use C4::Auth;
12 use strict;
13
14 my $input= new CGI;
15
16 my $flagsrequired;
17 $flagsrequired->{borrower}=1;
18 my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
19
20 #print $input->header;
21 #print $input->Dump;
22
23 #get all the data into a hash
24 my @names=$input->param;
25 my %data;
26 my $keyfld;
27 my $keyval;
28 my $problems;
29 my $env;
30 foreach my $key (@names){
31   $data{$key}=$input->param($key);
32 }
33 my $dbh=C4Connect;
34 my $surname=$data{'institution_name'};
35 my $query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,
36 firstname,altnotes,dateofbirth,contactname,emailaddress,dateenrolled,streetcity,
37 altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
38 initials,ethnicity,borrowernumber,guarantor,school) 
39 values ('','$data{'expiry'}','$data{'cardnumber_institution'}',
40 '','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}',
41 '$data{'firstname'}','$data{'altnotes'}','','$data{'contactname'}',
42 '$data{'emailaddress'}',
43 now(),'$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}',
44 '$data{'phoneday'}','I','$data{'city'}','$data{'area'}','$data{'phone'}',
45 '$data{'borrowernotes'}','$data{'altphone'}','$surname','$data{'initials'}',
46 '$data{'ethnicity'}','$data{'borrowernumber'}','','')";
47
48
49 #print $query;
50   my $sth2=$dbh->prepare($query);
51   $sth2->execute;
52   $sth2->finish;
53 #$sth->finish;
54
55 $dbh->disconnect;
56 print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$data{'borrowernumber'}");