3 #script to print confirmation screen, then if accepted calls itself to insert data
6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA 02111-1307 USA
31 #get varibale that tells us whether to show confirmation page
33 my $insert=$input->param('insert');
37 my @names=$input->param;
38 foreach my $key (@names){
39 $data{$key}=$input->param($key);
43 print startmenu('member');
45 my $image="/images/background-mem.gif";
48 #check that all compulsary fields are entered
49 my $string="The following compulsary fields have been left blank. Please push the back button
51 if ($data{'cardnumber'} eq ''){
53 $string.=" Cardnumber<br>";
56 #check cardnumber is valid
57 my $valid=checkdigit(\%env,$data{'cardnumber'});
60 $string.=" Invalid Cardnumber<br>";
63 if ($data{'sex'} eq ''){
64 $string.=" Gender <br>";
67 if ($data{'firstname'} eq ''){
68 $string.=" Given Names<br>";
71 if ($data{'surname'} eq ''){
72 $string.=" Surname<br>";
75 if ($data{'address'} eq ''){
76 $string.=" Postal Street Address<br>";
79 if ($data{'city'} eq ''){
80 $string.=" Postal City<br>";
83 if ($data{'contactname'} eq ''){
84 $string.=" Alternate Contact<br>";
87 #we are printing confirmation page
88 print mkheadr(1,'Confirm Record');
91 print mktablerow(2,$main,bold('NEW MEMBER'),"",$image);
92 my $name=$data{'title'}." ";
93 if ($data{'othernames'} ne ''){
94 $name.=$data{'othernames'}." ";
96 $name.=$data{'firstname'}." ";
98 $name.="$data{'surname'} ( $data{'firstname'}, $data{'initials'})";
99 print mktablerow(2,'white',bold('Name'),$name);
100 print mktablerow(2,$main,bold('MEMBERSHIP DETAILS'),"",$image);
101 print mktablerow(2,'white',bold('Membership Number'),$data{'borrowernumber'});
102 print mktablerow(2,'white',bold('Cardnumber'),$data{'cardnumber'});
103 print mktablerow(2,'white',bold('Membership Category'),$data{'categorycode'});
104 print mktablerow(2,'white',bold('Area'),$data{'area'});
105 print mktablerow(2,'white',bold('Fee'),$data{'fee'});
106 if ($data{'joining'} eq ''){
107 $data{'joining'}=ParseDate('today');
108 $data{'joining'}=&UnixDate($data{'joining'},'%Y-%m-%d');
110 print mktablerow(2,'white',bold('Joining Date'),$data{'joining'});
111 if ($data{'expiry'} eq ''){
112 $data{'expiry'}=ParseDate('in 1 year');
113 $data{'expiry'}=&UnixDate($data{'expiry'},'%Y-%m-%d');
115 print mktablerow(2,'white',bold('Expiry Date'),$data{'expiry'});
116 print mktablerow(2,'white',bold('Joining Branch'),$data{'joinbranch'});
117 print mktablerow(2,$main,bold('PERSONAL DETAILS'),"",$image);
118 my $ethnic=$data{'ethnicity'}." ".$data{'ethnicnotes'};
119 print mktablerow(2,'white',bold('Ethnicity'),$ethnic);
120 $data{'dateofbirth'}=ParseDate($data{'dateofbirth'});
121 $data{'dateofbirth'}=UnixDate($data{'dateofbirth'},'%Y-%m-%d');
122 print mktablerow(2,'white',bold('Date of Birth'),$data{'dateofbirth'});
124 if ($data{'sex'} eq 'M'){
129 print mktablerow(2,'white',bold('Sex'),$sex);
130 print mktablerow(2,$main,bold('MEMBER ADDRESS'),"",$image);
131 my $postal=$data{'address'}."<br>".$data{'city'};
133 if ($data{'streetaddress'} ne ''){
134 $home=$data{'streetaddress'}."<br>".$data{'streetcity'};
138 print mktablerow(2,'white',bold('Postal Address'),$postal);
139 print mktablerow(2,'white',bold('Home Address'),$home);
140 print mktablerow(2,$main,bold('MEMBER CONTACT DETAILS'),"",$image);
141 print mktablerow(2,'white',bold('Phone (Home)'),$data{'phone'});
142 print mktablerow(2,'white',bold('Phone (Daytime)'),$data{'phoneday'});
143 print mktablerow(2,'white',bold('Fax'),$data{'faxnumber'});
144 print mktablerow(2,'white',bold('Email'),$data{'emailaddress'});
145 print mktablerow(2,$main,bold('ALTERNATIVE CONTACT DETAILS'),"",$image);
146 print mktablerow(2,'white',bold('Name'),$data{'contactname'});
147 print mktablerow(2,'white',bold('Phone'),$data{'altphone'});
148 print mktablerow(2,'white',bold('Relationship'),$data{'altrelationship'});
149 print mktablerow(2,'white',bold('Notes'),$data{'altnotes'});
150 print mktablerow(2,$main,bold('Notes'),"",$image);
151 print mktablerow(2,'white',bold('General Notes'),$data{'borrowernotes'});
154 #set up form to post data thru for modification or insertion
157 while (my ($key, $value) = each %data) {
159 $inputs[$i]=["hidden","$key","$value"];
162 $inputs[$i]=["submit","submit","submit"];
163 print mkformnotable("/cgi-bin/koha/insertdata.pl",@inputs);
173 print endmenu('member');