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 => "members/newjmember.tmpl",
49 flagsrequired => {borrowers => 1},
55 my @names=$input->param;
56 foreach my $key (@names){
57 $data{$key}=$input->param($key);
61 for (my $i=0;$i<3;$i++){
62 my $number=$data{"cardnumber_child_$i"};
63 my $firstname=$data{"firstname_child_$i"};
64 my $surname=$data{"surname_child_$i"};
65 my $dob=$data{"dateofbirth_child_$i"};
66 my $sex=$data{"sex_child_$i"};
69 $template->param(cardnumber_missing => 1);
71 if ($firstname eq ''){
72 $template->param(firstname_missing => 1);
76 $template->param(surname_missing => 1);
80 $template->param(dob_missing => 1);
84 $template->param(gender_missing => 1);
89 if ($firstname eq ''){
90 $template->param(firstname_missing => 1);
94 $template->param(surname_missing => 1);
98 $template->param(dob_missing => 1);
102 $template->param(gender_missing => 1);
105 #check cardnumber is valid
107 if ( $data{'type'} ne "Add" ) {
112 my $valid=checkdigit(\%env,$number, $nounique);
114 $template->param(missing =>1);
115 $template->param(invalid_cardnumber => 1);
121 for (my $i=0;$i<3;$i++){
123 # $ident{'main'}=$main;
124 # $ident{'image'}=$image;
125 $ident{'cardchild'}=$data{"cardnumber_child_$i"};
126 if ($data{"cardnumber_child_$i"} ne ''){
127 my $name=$data{"firstname_child_$i"} . " " . $data{"surname_child_$i"};
128 $ident{'name'}=$name;
129 $ident{'bornum'}=$data{"bornumber_child_$i"};
130 $ident{'dob'}=$data{"dateofbirth_child_$i"};
131 ($data{"sex_child_$i"} eq 'M') ? ($ident{'sex'}="Male") : ($ident{'sex'}="Female") ;
132 $ident{'school'}=$data{"school_child_$i"};
133 $ident{'notes'}=$data{"altnotes_child_$i"};
134 push(@identsloop, \%ident);
138 while (my ($key, $value) = each %data) {
142 $line{'value'}=$value;
143 push(@inputsloop, \%line);
146 # FIXME IF main and image are not fetched by HTML::TEMPLATE get them into identsloop
147 $template->param( NOK => ($missing==1),
148 identsloop => \@identsloop,
149 inputsloop => \@inputsloop,
152 output_html_with_http_headers $input, $cookie, $template->output;