*** empty log message ***
[koha.git] / jmemberentry.pl
1 #!/usr/bin/perl
2
3 #script to set up screen for modification of borrower details
4 #written 20/12/99 by chris@katipo.co.nz
5
6
7 # Copyright 2000-2002 Katipo Communications
8 #
9 # This file is part of Koha.
10 #
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 #
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA  02111-1307 USA
23
24 use strict;
25 use C4::Auth;
26 use C4::Output;
27 use CGI;
28 use C4::Search;
29 use HTML::Template;
30
31 my $input = new CGI;
32
33 my ($template, $loggedinuser, $cookie)
34     = get_template_and_user({template_name => "members/jmemberentry.tmpl",
35                              query => $input,
36                              type => "intranet",
37                              authnotrequired => 0,
38                              flagsrequired => {borrowers => 1},
39                              debug => 1,
40                              });
41
42 my $member=$input->param('bornum');
43 if ($member eq ''){
44   $member=NewBorrowerNumber();
45 }
46 my $type=$input->param('type');
47
48 my $data=borrdata('',$member);
49
50 my @titles = ('Miss', 'Mrs', 'Ms', 'Mr', 'Dr', 'Sir');
51         # FIXME - Assumes English. This ought to be made part of i18n.
52 my @titledata;
53 while (@titles) {
54   my $title = shift @titles;
55   my %row = ('title' => $title);
56   if ($data->{'title'} eq $title) {
57     $row{'selected'}=' selected';
58   } else {
59     $row{'selected'}='';
60   }
61   push(@titledata, \%row);
62 }
63
64 # get the data for children
65 my $cmember1=NewBorrowerNumber();
66 my @cmemdata;
67 for (my $i=0;$i<3;$i++){
68   my %row;
69   $row{'cmember'}=$cmember1+$i;
70   $row{'i'}=$i;
71   $row{'count'}=$i+1;
72   push(@cmemdata, \%row);
73 }
74
75
76 $template->param( startmenumember => join('', startmenu('member')),
77                          endmenumember   => join('', endmenu('member')),
78                         endmenumember   => endmenu('member'),
79                         member         => $member,
80                         firstname       => $data->{'firstname'},
81                         surname         => $data->{'surname'},
82                         cardnumber      => $data->{'cardnumber'},
83                         area            => $data->{'area'},
84                         city            => $data->{'city'},
85                         address         => $data->{'address'},
86                         streetaddress   => $data->{'streetaddress'},
87                         streetcity      => $data->{'streetcity'},
88                         phone           => $data->{'phone'},
89                         phoneday        => $data->{'phoneday'},
90                         faxnumber       => $data->{'faxnumber'},
91                         emailaddress    => $data->{'emailaddress'},
92                         contactname     => $data->{'contactname'},
93                         altphone        => $data->{'altphone'},
94                         titleloop       => \@titledata,
95                         cmemloop        => \@cmemdata );
96
97 output_html_with_http_headers $input, $cookie, $template->output;