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