5 #script to print confirmation screen, then if accepted calls itself to insert data
6 # FIXME - Yes, but what does it _do_?
7 # 2002/12/18 hdl@ifrance.com templating
9 # Copyright 2000-2002 Katipo Communications
11 # This file is part of Koha.
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
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.
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
35 #get varibale that tells us whether to show confirmation page
37 my $insert=$input->param('insert');
41 my @names=$input->param;
42 foreach my $key (@names){
43 $data{$key}=$input->param($key);
46 my $template = gettemplate("newmember.tmpl");
47 #print $input->header;
49 #print startmenu('member');
51 my $image="/images/background-mem.gif";
54 #check that all compulsary fields are entered
55 my $string="The following compulsary fields have been left blank. Please push the back button
57 if ($data{'cardnumber'} eq ''){
59 $string.=" Cardnumber<br>";
62 #check cardnumber is valid
63 my $valid=checkdigit(\%env,$data{'cardnumber'});
66 $string.=" Invalid Cardnumber<br>";
69 if ($data{'sex'} eq ''){
70 $string.=" Gender <br>";
73 if ($data{'firstname'} eq ''){
74 $string.=" Given Names<br>";
77 if ($data{'surname'} eq ''){
78 $string.=" Surname<br>";
81 if ($data{'address'} eq ''){
82 $string.=" Postal Street Address<br>";
85 if ($data{'city'} eq ''){
86 $string.=" Postal City<br>";
89 if ($data{'contactname'} eq ''){
90 $string.=" Alternate Contact<br>";
93 #we are printing confirmation page
94 $template->param( OK=> ($ok==0),
97 my $name=$data{'title'}." ";
98 if ($data{'othernames'} ne ''){
99 $name.=$data{'othernames'}." ";
101 $name.=$data{'firstname'}." ";
103 $name.="$data{'surname'} ( $data{'firstname'}, $data{'initials'})";
105 if ($data{'sex'} eq 'M'){
110 if ($data{'joining'} eq ''){
111 $data{'joining'}=ParseDate('today');
112 $data{'joining'}=&UnixDate($data{'joining'},'%Y-%m-%d');
114 if ($data{'expiry'} eq ''){
115 $data{'expiry'}=ParseDate('in 1 year');
116 $data{'expiry'}=&UnixDate($data{'expiry'},'%Y-%m-%d');
118 my $ethnic=$data{'ethnicity'}." ".$data{'ethnicnotes'};
119 my $postal=$data{'address'}."<br>".$data{'city'};
121 if ($data{'streetaddress'} ne ''){
122 $home=$data{'streetaddress'}."<br>".$data{'streetcity'};
127 while (my ($key, $value) = each %data) {
131 $line{'value'}=$value;
132 push(@inputsloop, \%line);
135 $template->param(name => $name,
136 bornum => $data{'borrowernumber'},
137 cardnum => $data{'cardnumber'},
138 memcat => $data{'categorycode'},
139 area => $data{'area'},
141 joindate => $data{'joining'},
142 expdate => $data{'expiry'},
143 joinbranch => $data{'joinbranch'},
145 dob => $data{'dateofbirth'},
149 phone => $data{'phone'},
150 phoneday => $data{'phoneday'},
151 faxnumber => $data{'faxnumber'},
152 emailaddress => $data{'emailaddress'},
153 contactname => $data{'contactname'},
154 altphone => $data{'altphone'},
155 altrelationship => $data{'altrelationship'},
156 altnotes => $data{'altnotes'},
157 bornotes => $data{'borrowernotes'},
158 inputsloop => \@inputsloop);
160 print "Content-Type: text/html\n\n", $template->output;