fix for #277
[koha.git] / insertidata.pl
blob9291a6c8d018946de5925c3276d062db1a435b9e
1 #!/usr/bin/perl
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
8 # Copyright 2000-2002 Katipo Communications
10 # This file is part of Koha.
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.
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.
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
25 use CGI;
26 use C4::Context;
27 use C4::Input;
28 use Date::Manip;
29 use strict;
31 my $input= new CGI;
32 #print $input->header;
33 #print $input->Dump;
35 #get all the data into a hash
36 my @names=$input->param;
37 my %data;
38 my $keyfld;
39 my $keyval;
40 my $problems;
41 my $env;
42 foreach my $key (@names){
43 $data{$key}=$input->param($key);
45 my $dbh = C4::Context->dbh;
46 my $surname=$data{'institution_name'};
47 my $query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,
48 firstname,altnotes,dateofbirth,contactname,emailaddress,dateenrolled,streetcity,
49 altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
50 initials,ethnicity,borrowernumber,guarantor,school)
51 values ('','$data{'expiry'}','$data{'cardnumber_institution'}',
52 '','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}',
53 '$data{'firstname'}','$data{'altnotes'}','','$data{'contactname'}',
54 '$data{'emailaddress'}',
55 now(),'$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}',
56 '$data{'phoneday'}','I','$data{'city'}','$data{'area'}','$data{'phone'}',
57 '$data{'borrowernotes'}','$data{'altphone'}','$surname','$data{'initials'}',
58 '$data{'ethnicity'}','$data{'borrowernumber'}','','')";
61 #print $query;
62 my $sth2=$dbh->prepare($query);
63 $sth2->execute;
64 $sth2->finish;
65 #$sth->finish;
67 print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$data{'borrowernumber'}");