don't escape '-' in regexp.
[koha.git] / members / borrowers_details.pl
1 #!/usr/bin/perl
2 # NOTE: This file uses standard 8-space tabs
3 #       DO NOT SET TAB SIZE TO 4
4
5 # $Id$
6
7 #script to set up screen for modification of borrower details
8 #written 20/12/99 by chris@katipo.co.nz
9
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
28 use strict;
29 use Date::Manip;
30 use CGI;
31 use C4::Auth;
32 use C4::Context;
33 use C4::Output;
34 use C4::Members;
35 use C4::Koha;
36 use C4::Date;
37 use C4::Input;
38 use C4::Log;
39 my $input = new CGI;
40 my $dbh = C4::Context->dbh;
41 my %data;
42
43 my ($template, $loggedinuser, $cookie)
44     = get_template_and_user({template_name => "members/borrowers_details.tmpl",
45                              query => $input,
46                              type => "intranet",
47                              authnotrequired => 0,
48                              flagsrequired => {borrowers => 1},
49                              debug => 1,
50                              });
51
52 my $data;
53 my $categorycode=$input->param('categorycode');
54 my $borrowernumber=$input->param('borrowernumber');
55 my $description=$input->param('description');
56 my $category_type=$input->param('category_type');
57
58  if ( $data{'surname'} eq '') 
59         {
60                 $data=GetMember($borrowernumber,'borrowernumber');
61                 %data=%$data;
62         }
63  my $borrowercategory = GetBorrowercategory($data{'categorycode'});     
64
65 $template->param(               borrowernumber  => $borrowernumber,#register number
66                                 #transform value  in capital or capital for first letter of the word
67                                 firstname       => ucfirst($data{'firstname'}),
68                                 surname         => uc($data{'surname'}),
69                                 categorycode    => $data{'categorycode'},
70                                 title           => $data{'title'},
71                                 category_type   => $borrowercategory ->{'category_type'},
72                                 "title_".$data{'title'}             => " SELECTED ",                    
73                                 dateofbirth     => format_date($data{'dateofbirth'}),
74                                 description     => $borrowercategory->{'description'}
75                                 );
76         $template->param(Institution => 1) if ($category_type eq "I");
77         output_html_with_http_headers $input, $cookie, $template->output;
78
79 # Local Variables:
80 # tab-width: 8
81 # End: