fixed a couple of bugs. Note this version of opac-reserve.pl is designed to work...
[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 use C4::Interface::CGI::Output;
31
32 my $input = new CGI;
33
34 my ($template, $loggedinuser, $cookie)
35     = get_template_and_user({template_name => "members/jmemberentry.tmpl",
36                              query => $input,
37                              type => "intranet",
38                              authnotrequired => 0,
39                              flagsrequired => {borrowers => 1},
40                              debug => 1,
41                              });
42
43 my $member=$input->param('bornum');
44 if ($member eq ''){
45   $member=NewBorrowerNumber();
46 }
47 my $type=$input->param('type');
48
49 my $data=borrdata('',$member);
50
51 my @titles = ('Miss', 'Mrs', 'Ms', 'Mr', 'Dr', 'Sir');
52         # FIXME - Assumes English. This ought to be made part of i18n.
53 my @titledata;
54 while (@titles) {
55   my $title = shift @titles;
56   my %row = ('title' => $title);
57   if ($data->{'title'} eq $title) {
58     $row{'selected'}=' selected';
59   } else {
60     $row{'selected'}='';
61   }
62   push(@titledata, \%row);
63 }
64
65 # get the data for children
66 my $cmember1=NewBorrowerNumber();
67 my @cmemdata;
68 for (my $i=0;$i<3;$i++){
69   my %row;
70   $row{'cmember'}=$cmember1+$i;
71   $row{'i'}=$i;
72   $row{'count'}=$i+1;
73   push(@cmemdata, \%row);
74 }
75
76
77 $template->param( startmenumember => join('', startmenu('member')),
78                          endmenumember   => join('', endmenu('member')),
79                         endmenumember   => endmenu('member'),
80                         member         => $member,
81                         firstname       => $data->{'firstname'},
82                         surname         => $data->{'surname'},
83                         cardnumber      => $data->{'cardnumber'},
84                         area            => $data->{'area'},
85                         city            => $data->{'city'},
86                         address         => $data->{'address'},
87                         streetaddress   => $data->{'streetaddress'},
88                         streetcity      => $data->{'streetcity'},
89                         phone           => $data->{'phone'},
90                         phoneday        => $data->{'phoneday'},
91                         faxnumber       => $data->{'faxnumber'},
92                         emailaddress    => $data->{'emailaddress'},
93                         contactname     => $data->{'contactname'},
94                         altphone        => $data->{'altphone'},
95                         titleloop       => \@titledata,
96                         cmemloop        => \@cmemdata );
97
98 output_html_with_http_headers $input, $cookie, $template->output;