5 #script to print confirmation screen, then if accepted calls itself to insert data
6 # FIXME - Yes, but what does it _do_?
8 # Copyright 2000-2002 Katipo Communications
10 # This file is part of Koha.
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License along with
22 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 # Suite 330, Boston, MA 02111-1307 USA
33 #get varibale that tells us whether to show confirmation page
35 my $insert=$input->param('insert');
39 my @names=$input->param;
40 foreach my $key (@names){
41 $data{$key}=$input->param($key);
45 print startmenu('member');
47 my $image="/images/background-mem.gif";
50 #check that all compulsary fields are entered
51 my $string="The following compulsary fields have been left blank. Please push the back button
53 if ($data{'cardnumber'} eq ''){
55 $string.=" Cardnumber<br>";
58 #check cardnumber is valid
59 my $valid=checkdigit(\%env,$data{'cardnumber'});
62 $string.=" Invalid Cardnumber<br>";
65 if ($data{'sex'} eq ''){
66 $string.=" Gender <br>";
69 if ($data{'firstname'} eq ''){
70 $string.=" Given Names<br>";
73 if ($data{'surname'} eq ''){
74 $string.=" Surname<br>";
77 if ($data{'address'} eq ''){
78 $string.=" Postal Street Address<br>";
81 if ($data{'city'} eq ''){
82 $string.=" Postal City<br>";
85 if ($data{'contactname'} eq ''){
86 $string.=" Alternate Contact<br>";
89 #we are printing confirmation page
90 print mkheadr(1,'Confirm Record');
93 print mktablerow(2,$main,bold('NEW MEMBER'),"",$image);
94 my $name=$data{'title'}." ";
95 if ($data{'othernames'} ne ''){
96 $name.=$data{'othernames'}." ";
98 $name.=$data{'firstname'}." ";
100 $name.="$data{'surname'} ( $data{'firstname'}, $data{'initials'})";
101 print mktablerow(2,'white',bold('Name'),$name);
102 print mktablerow(2,$main,bold('MEMBERSHIP DETAILS'),"",$image);
103 print mktablerow(2,'white',bold('Membership Number'),$data{'borrowernumber'});
104 print mktablerow(2,'white',bold('Cardnumber'),$data{'cardnumber'});
105 print mktablerow(2,'white',bold('Membership Category'),$data{'categorycode'});
106 print mktablerow(2,'white',bold('Area'),$data{'area'});
107 print mktablerow(2,'white',bold('Fee'),$data{'fee'});
108 if ($data{'joining'} eq ''){
109 $data{'joining'}=ParseDate('today');
110 $data{'joining'}=&UnixDate($data{'joining'},'%Y-%m-%d');
112 print mktablerow(2,'white',bold('Joining Date'),$data{'joining'});
113 if ($data{'expiry'} eq ''){
114 $data{'expiry'}=ParseDate('in 1 year');
115 $data{'expiry'}=&UnixDate($data{'expiry'},'%Y-%m-%d');
117 print mktablerow(2,'white',bold('Expiry Date'),$data{'expiry'});
118 print mktablerow(2,'white',bold('Joining Branch'),$data{'joinbranch'});
119 print mktablerow(2,$main,bold('PERSONAL DETAILS'),"",$image);
120 my $ethnic=$data{'ethnicity'}." ".$data{'ethnicnotes'};
121 print mktablerow(2,'white',bold('Ethnicity'),$ethnic);
122 $data{'dateofbirth'}=ParseDate($data{'dateofbirth'});
123 $data{'dateofbirth'}=UnixDate($data{'dateofbirth'},'%Y-%m-%d');
124 print mktablerow(2,'white',bold('Date of Birth'),$data{'dateofbirth'});
126 if ($data{'sex'} eq 'M'){
131 print mktablerow(2,'white',bold('Sex'),$sex);
132 print mktablerow(2,$main,bold('MEMBER ADDRESS'),"",$image);
133 my $postal=$data{'address'}."<br>".$data{'city'};
135 if ($data{'streetaddress'} ne ''){
136 $home=$data{'streetaddress'}."<br>".$data{'streetcity'};
140 print mktablerow(2,'white',bold('Postal Address'),$postal);
141 print mktablerow(2,'white',bold('Home Address'),$home);
142 print mktablerow(2,$main,bold('MEMBER CONTACT DETAILS'),"",$image);
143 print mktablerow(2,'white',bold('Phone (Home)'),$data{'phone'});
144 print mktablerow(2,'white',bold('Phone (Daytime)'),$data{'phoneday'});
145 print mktablerow(2,'white',bold('Fax'),$data{'faxnumber'});
146 print mktablerow(2,'white',bold('Email'),$data{'emailaddress'});
147 print mktablerow(2,$main,bold('ALTERNATIVE CONTACT DETAILS'),"",$image);
148 print mktablerow(2,'white',bold('Name'),$data{'contactname'});
149 print mktablerow(2,'white',bold('Phone'),$data{'altphone'});
150 print mktablerow(2,'white',bold('Relationship'),$data{'altrelationship'});
151 print mktablerow(2,'white',bold('Notes'),$data{'altnotes'});
152 print mktablerow(2,$main,bold('Notes'),"",$image);
153 print mktablerow(2,'white',bold('General Notes'),$data{'borrowernotes'});
156 #set up form to post data thru for modification or insertion
159 while (my ($key, $value) = each %data) {
161 $inputs[$i]=["hidden","$key","$value"];
164 $inputs[$i]=["submit","submit","submit"];
165 print mkformnotable("/cgi-bin/koha/insertdata.pl",@inputs);
175 print endmenu('member');