Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 131 lines (120 sloc) 3.709 kb
d0374d0 Initial revision
rangi authored
1 #!/usr/bin/perl
2
7be6b41 Removed trailing whitespace.
arensb authored
3 # $Id$
d0374d0 Initial revision
rangi authored
4
7be6b41 Removed trailing whitespace.
arensb authored
5 #script to print confirmation screen, then if accepted calls itself to insert data
6 # FIXME - Yes, but what does it _do_?
c1614d9 Templating newjmember.pl
hdl authored
7 # 2002/12/18 hdl@ifrance.comTemplating
1e67687 Added copyright statement to all .pl and .pm files
tonnesen authored
8
9 # Copyright 2000-2002 Katipo Communications
10 #
11 # This file is part of Koha.
12 #
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
16 # version.
17 #
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.
21 #
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
25
d0374d0 Initial revision
rangi authored
26 use strict;
04fdb2e fix for #277
tipaul authored
27 use C4::Auth;
28 use C4::Context;
d0374d0 Initial revision
rangi authored
29 use C4::Output;
30 use C4::Input;
04fdb2e fix for #277
tipaul authored
31 use C4::Interface::CGI::Output;
32 use C4::Interface::CGI::Template;
33 use C4::Koha;
d0374d0 Initial revision
rangi authored
34 use CGI;
35 use Date::Manip;
c1614d9 Templating newjmember.pl
hdl authored
36 use HTML::Template;
d0374d0 Initial revision
rangi authored
37
38 my %env;
39 my $input = new CGI;
40 #get varibale that tells us whether to show confirmation page
41 #or insert data
42 my $insert=$input->param('insert');
c1614d9 Templating newjmember.pl
hdl authored
43
04fdb2e fix for #277
tipaul authored
44 my ($template, $loggedinuser, $cookie)
45 = get_template_and_user({template_name => "newjmember.tmpl",
46 query => $input,
47 type => "intranet",
48 authnotrequired => 0,
49 flagsrequired => {borrowers => 1},
50 debug => 1,
51 });
c1614d9 Templating newjmember.pl
hdl authored
52
d0374d0 Initial revision
rangi authored
53 #get rest of data
54 my %data;
55 my @names=$input->param;
7be6b41 Removed trailing whitespace.
arensb authored
56 foreach my $key (@names){
57 $data{$key}=$input->param($key);
58 }
6928584 *** empty log message ***
wolfpac444 authored
59 my $missing=0;
d0374d0 Initial revision
rangi authored
60
61 my $string="The following compulsary fields have been left blank. Please push the back button
7be6b41 Removed trailing whitespace.
arensb authored
62 and try again<p>";
d0374d0 Initial revision
rangi authored
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"};
7be6b41 Removed trailing whitespace.
arensb authored
69 if ($number eq ''){
d0374d0 Initial revision
rangi authored
70 if ($i == 0){
7be6b41 Removed trailing whitespace.
arensb authored
71 $string.=" Cardnumber<br>";
6928584 *** empty log message ***
wolfpac444 authored
72 $missing=1;
d0374d0 Initial revision
rangi authored
73 }
74 } else {
7be6b41 Removed trailing whitespace.
arensb authored
75 if ($firstname eq ''){
76 $string.=" Given Names<br>";
6928584 *** empty log message ***
wolfpac444 authored
77 $missing=1;
7be6b41 Removed trailing whitespace.
arensb authored
78 }
79 if ($surname eq ''){
80 $string.=" Surname<br>";
6928584 *** empty log message ***
wolfpac444 authored
81 $missing=1;
7be6b41 Removed trailing whitespace.
arensb authored
82 }
83 if ($dob eq ''){
84 $string.=" Date Of Birth<br>";
6928584 *** empty log message ***
wolfpac444 authored
85 $missing=1;
d0374d0 Initial revision
rangi authored
86 }
7be6b41 Removed trailing whitespace.
arensb authored
87 if ($sex eq ''){
88 $string.=" Gender <br>";
6928584 *** empty log message ***
wolfpac444 authored
89 $missing=1;
d0374d0 Initial revision
rangi authored
90 }
7be6b41 Removed trailing whitespace.
arensb authored
91 my $valid=checkdigit(\%env,$data{"cardnumber_child_$i"});
92 if ($valid != 1){
d0374d0 Initial revision
rangi authored
93 $string.=" Invalid Cardnumber $number<br>";
6928584 *** empty log message ***
wolfpac444 authored
94 $missing=1;
7be6b41 Removed trailing whitespace.
arensb authored
95 }
d0374d0 Initial revision
rangi authored
96 }
97 }
c1614d9 Templating newjmember.pl
hdl authored
98 my @identsloop;
99 for (my $i=0;$i<3;$i++){
100 my %ident;
101 # $ident{'main'}=$main;
102 # $ident{'image'}=$image;
04fdb2e fix for #277
tipaul authored
103 $ident{'cardchild'}=($data{"cardnumber_child_$i"} ne '');
c1614d9 Templating newjmember.pl
hdl authored
104 if ($data{"cardnumber_child_$i"} ne ''){
2193f51 Fixed bug #404
wolfpac444 authored
105 my $name=$data{"firstname_child_$i"} . " " . $data{"surname_child_$i"};
c1614d9 Templating newjmember.pl
hdl authored
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"};
04fdb2e fix for #277
tipaul authored
111 $ident{'notes'}=$data{"altnotes_child_$i"};
c1614d9 Templating newjmember.pl
hdl authored
112 push(@identsloop, \%ident);
113 }
114 }
115 my @inputsloop;
116 while (my ($key, $value) = each %data) {
117 $value=~ s/\"/%22/g;
118 my %line;
119 $line{'key'}=$key;
120 $line{'value'}=$value;
121 push(@inputsloop, \%line);
122 }
d0374d0 Initial revision
rangi authored
123
c1614d9 Templating newjmember.pl
hdl authored
124 # FIXME IF main and image are not fetched by HTML::TEMPLATE get them into identsloop
6928584 *** empty log message ***
wolfpac444 authored
125 $template->param( NOK => ($missing==1),
c1614d9 Templating newjmember.pl
hdl authored
126 identsloop => \@identsloop,
127 inputsloop => \@inputsloop,
128 string => $string);
d0374d0 Initial revision
rangi authored
129
04fdb2e fix for #277
tipaul authored
130 output_html_with_http_headers $input, $cookie, $template->output;
Something went wrong with that request. Please try again.