Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 193 lines (172 sloc) 5.734 kb
d0374d0 Initial revision
rangi authored
1 #!/usr/bin/perl
7d7deb7 Moved the cardnumber generation logic out of memberentry.pl; new module
acli authored
2 # NOTE: This file uses standard 8-space tabs
3 # DO NOT SET TAB SIZE TO 4
d0374d0 Initial revision
rangi authored
4
7197a37 Added magic RCS comment.
arensb authored
5 # $Id$
6
d0374d0 Initial revision
rangi authored
7 #script to set up screen for modification of borrower details
8 #written 20/12/99 by chris@katipo.co.nz
9
1e67687 Added copyright statement to all .pl and .pm files
tonnesen authored
10
11 # Copyright 2000-2002 Katipo Communications
12 #
13 # This file is part of Koha.
14 #
15 # Koha is free software; you can redistribute it and/or modify it under the
16 # terms of the GNU General Public License as published by the Free Software
17 # Foundation; either version 2 of the License, or (at your option) any later
18 # version.
19 #
20 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
21 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
22 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License along with
25 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
26 # Suite 330, Boston, MA 02111-1307 USA
27
d0374d0 Initial revision
rangi authored
28 use strict;
9d54a64 adding authentification with Auth.pm
tipaul authored
29 use C4::Auth;
dbca398 Merged with arensb-context branch: use C4::Context->dbh instead of
arensb authored
30 use C4::Context;
d0374d0 Initial revision
rangi authored
31 use C4::Output;
52a5fd4 Moved C4/Charset.pm to C4/Interface/CGI/Output.pm
acli authored
32 use C4::Interface::CGI::Output;
d0374d0 Initial revision
rangi authored
33 use CGI;
34 use C4::Search;
7d7deb7 Moved the cardnumber generation logic out of memberentry.pl; new module
acli authored
35 use C4::Members;
fbe10b8 merging 1.2 and main branches. main branch now uses ethnicity SQL table
tipaul authored
36 use C4::Koha;
0f24c70 templatified:set templatedirectory in koha.conf to use the templates
dnmeid authored
37 use HTML::Template;
5347b92 bugfix
tipaul authored
38 use Date::Manip;
398a4d5 Fixed Bug #230.
wolfpac444 authored
39 use C4::Date;
d0374d0 Initial revision
rangi authored
40
41 my $input = new CGI;
0f24c70 templatified:set templatedirectory in koha.conf to use the templates
dnmeid authored
42
9d54a64 adding authentification with Auth.pm
tipaul authored
43 my ($template, $loggedinuser, $cookie)
44 = get_template_and_user({template_name => "members/memberentry.tmpl",
45 query => $input,
46 type => "intranet",
47 authnotrequired => 0,
48 flagsrequired => {borrowers => 1},
49 debug => 1,
50 });
0f24c70 templatified:set templatedirectory in koha.conf to use the templates
dnmeid authored
51
d0374d0 Initial revision
rangi authored
52 my $member=$input->param('bornum');
53 if ($member eq ''){
3583bd6 "tab-ing" script
tipaul authored
54 $member=NewBorrowerNumber();
d0374d0 Initial revision
rangi authored
55 }
0f24c70 templatified:set templatedirectory in koha.conf to use the templates
dnmeid authored
56 my $type=$input->param('type') || '';
2d60bc0 Bug fix for bug 524
rangi authored
57 my $modify=$input->param('modify');
58 my $delete=$input->param('delete');
e81f216 Fix to handle the delete call, redirects to deletemem.pl
rangi authored
59 if ($delete){
3583bd6 "tab-ing" script
tipaul authored
60 print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$member");
0f24c70 templatified:set templatedirectory in koha.conf to use the templates
dnmeid authored
61 } else { # this else goes down the whole script
3583bd6 "tab-ing" script
tipaul authored
62 if ($type ne 'Add'){
63 $template->param( header => 'Update Member Details'); # bad templating style
64 } else {
65 $template->param( header => 'Add New Member');
66 }
67
68 my $data=borrdata('',$member);
69 warn "data: ".$data->{'surname'};
70 if ($type eq 'Add'){
71 $template->param( updtype => 'I');
72 } else {
73 $template->param( updtype => 'M');
74 }
75 my $cardnumber=C4::Members::fixup_cardnumber($data->{'cardnumber'});
76 if ($data->{'sex'} eq 'F'){
77 $template->param(female => 1);
78 }
79 my ($categories,$labels)=ethnicitycategories();
80 my $ethnicitycategoriescount=$#{$categories};
81 my $ethcatpopup;
82 if ($ethnicitycategoriescount>=0) {
83 $ethcatpopup = CGI::popup_menu(-name=>'ethnicity',
84 -values=>$categories,
85 -default=>$data->{'ethnicity'},
86 -labels=>$labels);
87 $template->param(ethcatpopup => $ethcatpopup); # bad style, has to be fixed
88 }
89
90 ($categories,$labels)=borrowercategories();
91 my $catcodepopup = CGI::popup_menu(-name=>'categorycode',
92 -values=>$categories,
93 -default=>$data->{'categorycode'},
94 -labels=>$labels);
95
96 my @relationships = ('workplace', 'relative','friend', 'neighbour');
97 my @relshipdata;
98 while (@relationships) {
99 my $relship = shift @relationships;
100 my %row = ('relationship' => $relship);
101 if ($data->{'altrelationship'} eq $relship) {
102 $row{'selected'}=' selected';
103 } else {
104 $row{'selected'}='';
105 }
106 push(@relshipdata, \%row);
107 }
108
109 # %flags: keys=$data-keys, datas=[formname, HTML-explanation]
110 my %flags = ('gonenoaddress' => ['gna', 'Gone no address'],
111 'lost' => ['lost', 'Lost'],
112 'debarred' => ['debarred', 'Debarred']);
113
114 my @flagdata;
115 foreach (keys(%flags)) {
116 my $key = $_;
117 my %row = ('key' => $key,
118 'name' => $flags{$key}[0],
119 'html' => $flags{$key}[1]);
120 if ($data->{$key}) {
121 $row{'yes'}=' checked';
122 $row{'no'}='';
123 } else {
124 $row{'yes'}='';
125 $row{'no'}=' checked';
126 }
127 push(@flagdata, \%row);
128 }
129
130 if ($modify){
131 $template->param( modify => 1 );
132 }
133
134 #Convert dateofbirth to correct format
135 $data->{'dateofbirth'} = format_date($data->{'dateofbirth'});
0aaaa1c Fixed Bug #196 by using Date::Manip to put the date in the correct forma...
wolfpac444 authored
136
5edc7ef fixes for #207, 208, 211
tipaul authored
137 my @branches;
138 my @select_branch;
139 my %select_branches;
140 my $branches=getbranches();
141 foreach my $branch (keys %$branches) {
142 push @select_branch, $branch;
143 $select_branches{$branch} = $branches->{$branch}->{'branchname'};
144 }
04fdb2e fix for #277
tipaul authored
145 my $CGIbranch=CGI::scrolling_list( -name => 'branchcode',
5edc7ef fixes for #207, 208, 211
tipaul authored
146 -values => \@select_branch,
147 -default => $data->{'branchcode'},
148 -labels => \%select_branches,
149 -size => 1,
150 -multiple => 0 );
151
4cef812 *** empty log message ***
wolfpac444 authored
152 $template->param( type => $type,
3583bd6 "tab-ing" script
tipaul authored
153 member => $member,
154 address => $data->{'streetaddress'},
155 firstname => $data->{'firstname'},
156 surname => $data->{'surname'},
157 othernames => $data->{'othernames'},
158 initials => $data->{'initials'},
159 ethcatpopup => $ethcatpopup,
160 catcodepopup => $catcodepopup,
161 streetaddress => $data->{'physstreet'},
162 zipcode => $data->{'zipcode'},
163 streetcity => $data->{'streetcity'},
164 homezipcode => $data->{'homezipcode'},
165 city => $data->{'city'},
166 phone => $data->{'phone'},
167 phoneday => $data->{'phoneday'},
168 faxnumber => $data->{'faxnumber'},
169 emailaddress => $data->{'emailaddress'},
170 textmessaging => $data->{'textmessaging'},
171 contactname => $data->{'contactname'},
172 altphone => $data->{'altphone'},
173 altnotes => $data->{'altnotes'},
174 borrowernotes => $data->{'borrowernotes'},
175 flagloop => \@flagdata,
176 relshiploop => \@relshipdata,
177 "title_".$data->{'title'} => " SELECTED ",
178 dateenrolled => $data->{'dateenrolled'},
179 expiry => $data->{'expiry'},
180 cardnumber => $cardnumber,
181 dateofbirth => $data->{'dateofbirth'},
182 dateformat => display_date_format(),
2d60bc0 Bug fix for bug 524
rangi authored
183 modify => $modify,
3583bd6 "tab-ing" script
tipaul authored
184 CGIbranch => $CGIbranch);
185 output_html_with_http_headers $input, $cookie, $template->output;
7197a37 Added magic RCS comment.
arensb authored
186
d0374d0 Initial revision
rangi authored
187
e81f216 Fix to handle the delete call, redirects to deletemem.pl
rangi authored
188 }
7d7deb7 Moved the cardnumber generation logic out of memberentry.pl; new module
acli authored
189
190 # Local Variables:
191 # tab-width: 8
192 # End:
Something went wrong with that request. Please try again.