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.comTemplating
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
31 use C4::Interface::CGI::Output;
32 use C4::Interface::CGI::Template;
40 #get varibale that tells us whether to show confirmation page
42 my $insert=$input->param('insert');
44 my ($template, $loggedinuser, $cookie)
45 = get_template_and_user({template_name => "newjmember.tmpl",
49 flagsrequired => {borrowers => 1},
55 my @names=$input->param;
56 foreach my $key (@names){
57 $data{$key}=$input->param($key);
61 my $string="The following compulsary fields have been left blank. Please push the back button
63 for (my $i=0;$i<3;$i++){
64 my $number=$data{"cardnumber_child_$i"};
65 my $firstname=$data{"firstname_child_$i"};
66 my $surname=$data{"surname_child_$i"};
67 my $dob=$data{"dateofbirth_child_$i"};
68 my $sex=$data{"sex_child_$i"};
71 $string.=" Cardnumber<br>";
75 if ($firstname eq ''){
76 $string.=" Given Names<br>";
80 $string.=" Surname<br>";
84 $string.=" Date Of Birth<br>";
88 $string.=" Gender <br>";
91 my $valid=checkdigit(\%env,$data{"cardnumber_child_$i"});
93 $string.=" Invalid Cardnumber $number<br>";
99 for (my $i=0;$i<3;$i++){
101 # $ident{'main'}=$main;
102 # $ident{'image'}=$image;
103 $ident{'cardchild'}=($data{"cardnumber_child_$i"} ne '');
104 if ($data{"cardnumber_child_$i"} ne ''){
105 my $name=$data{"firstname_child_$i"} . " " . $data{"surname_child_$i"};
106 $ident{'name'}=$name;
107 $ident{'bornum'}=$data{"bornumber_child_$i"};
108 $ident{'dob'}=$data{"dateofbirth_child_$i"};
109 ($data{"sex_child_$i"} eq 'M') ? ($ident{'sex'}="Male") : ($ident{'sex'}="Female") ;
110 $ident{'school'}=$data{"school_child_$i"};
111 $ident{'notes'}=$data{"altnotes_child_$i"};
112 push(@identsloop, \%ident);
116 while (my ($key, $value) = each %data) {
120 $line{'value'}=$value;
121 push(@inputsloop, \%line);
124 # FIXME IF main and image are not fetched by HTML::TEMPLATE get them into identsloop
125 $template->param( NOK => ($missing==1),
126 identsloop => \@identsloop,
127 inputsloop => \@inputsloop,
130 output_html_with_http_headers $input, $cookie, $template->output;