2 # Note: This file now uses standard 8-space tabs
6 #script to print confirmation screen,
7 #then if accepted calls itself to insert data
8 #modified 2002/12/16 by hdl@ifrance.com : Templating
9 #the "parent" is imemberentry.pl
12 # Copyright 2000-2003 Katipo Communications
14 # This file is part of Koha.
16 # Koha is free software; you can redistribute it and/or modify it under the
17 # terms of the GNU General Public License as published by the Free Software
18 # Foundation; either version 2 of the License, or (at your option) any later
21 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
22 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
23 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License along with
26 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
27 # Suite 330, Boston, MA 02111-1307 USA
33 use C4::Interface::CGI::Output;
41 #get varibale that tells us whether to show confirmation page
43 my $insert=$input->param('insert');
45 my ($template, $loggedinuser, $cookie) = get_template_and_user({
46 template_name => "newimember.tmpl",
50 flagsrequired => {borrowers => 1},
56 my @names=$input->param;
57 foreach my $key (@names){
58 $data{$key}=$input->param($key);
63 my $string="The following compulsary fields have been left blank. Please push the back button
65 if ($data{'cardnumber_institution'} !~ /\S/){
66 $string.="Cardnumber<br>";
69 if ($data{'institution_name'} !~ /\S/){
70 $string.="Institution Name<br>";
73 if ($data{'address'} !~ /\S/){
74 $string.="Postal Address<br>";
77 if ($data{'city'} !~ /\S/){
81 if ($data{'contactname'} !~ /\S/){
82 $string.="Contact Name";
86 $template->param( missingloop => ($missing==1));
87 $template->param( string => $string);
89 $data{'cardnumber_institution'} = C4::Members::fixup_cardnumber
90 ($data{'cardnumber_institution'});
92 #check cardnumber is valid
94 if ( $data{'type'} ne "Add" ) {
99 my $valid=checkdigit(\%env,$data{'cardnumber'}, $nounique);
101 $template->param( invalid => ($valid !=1));
105 while (my ($key, $value) = each %data) {
106 push(@inputs, { 'key' => $key,
107 'value' => CGI::escapeHTML($value) });
109 $template->param(institution_name => $data{institution_name},
110 bornum => $data{'borrowernumber'},
111 cardnumber_institution => $data{'cardnumber_institution'},
112 memcat => $data{'categorycode'},
113 branchcode => $data{'branchcode'},
115 postal => $data{postal},
117 zipcode => $data{'zipcode'},
118 homezipcode => $data{'homezipcode'},
119 phone => $data{'phone'},
120 phoneday => $data{'phoneday'},
121 faxnumber => $data{'faxnumber'},
122 emailaddress => $data{'emailaddress'},
123 textmessaging => $data{'textmessaging'},
124 contactname => $data{'contactname'},
125 altphone => $data{'altphone'},
126 altrelationship => $data{'altrelationship'},
127 altnotes => $data{'altnotes'},
128 bornotes => $data{'borrowernotes'},
129 inputsloop => \@inputs);
132 output_html_with_http_headers $input, $cookie, $template->output;