Continuing work on Z39.50 search tool. Daemon now forks up to 12 processes
[koha.git] / newimember.pl
blobf370d2b8c92a7c626d4072c099d1920772acaf79
1 #!/usr/bin/perl
3 #script to print confirmation screen, then if accepted calls itself to insert data
5 use strict;
6 use C4::Output;
7 use C4::Input;
8 use CGI;
9 use Date::Manip;
11 my %env;
12 my $input = new CGI;
13 #get varibale that tells us whether to show confirmation page
14 #or insert data
15 my $insert=$input->param('insert');
16 print $input->header;
17 #get rest of data
18 my %data;
19 my @names=$input->param;
20 foreach my $key (@names){
21 $data{$key}=$input->param($key);
23 my $ok=0;
25 my $string="The following compulsary fields have been left blank. Please push the back button
26 and try again<p>";
27 if ($data{'cardnumber_institution'} eq ''){
28 $string.="Cardnumber<br>";
29 $ok=1;
31 if ($data{'institution_name'} eq ''){
32 $string.="Institution Name<br>";
33 $ok=1;
35 if ($data{'address'} eq ''){
36 $string.="Postal Address<br>";
37 $ok=1;
39 if ($data{'city'} eq ''){
40 $string.="City<br>";
41 $ok=1;
43 if ($data{'contactname'} eq ''){
44 $string.="Contact Name";
45 $ok=1;
47 #print $input->Dump;
48 #print $string;
49 print startmenu('member');
50 if ($ok ==1){
51 print $string;
52 } else {
53 my $valid=checkdigit(\%env,$data{"cardnumber_institution"});
54 if ($valid != 1){
55 print "Invalid cardnumber";
56 } else {
58 my @inputs;
59 my $i=0;
60 while (my ($key, $value) = each %data) {
61 $value=~ s/\"/%22/g;
62 $inputs[$i]=["hidden","$key","$value"];
63 $i++;
65 $inputs[$i]=["submit","submit","submit"];
66 print mkformnotable("/cgi-bin/koha/insertidata.pl",@inputs);
69 print endmenu('member');
70 print endpage();