adding authentification with Auth.pm
[koha.git] / member.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 #script to do a borrower enquiery/brin up borrower details etc
6 #written 20/12/99 by chris@katipo.co.nz
7
8
9 # Copyright 2000-2002 Katipo Communications
10 #
11 # This file is part of Koha.
12 #
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
16 # version.
17 #
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA  02111-1307 USA
25
26 use strict;
27 use C4::Auth;
28 use C4::Output;
29 use CGI;
30 use C4::Search;
31 use HTML::Template;
32
33 my $input = new CGI;
34
35 my $theme = $input->param('theme') || "default";
36                         # only used if allowthemeoverride is set
37 #my %tmpldata = pathtotemplate ( template => 'member.tmpl', theme => $theme, language => 'fi' );
38         # FIXME - Error-checking
39 #my $template = HTML::Template->new( filename => $tmpldata{'path'},
40 #                                   die_on_bad_params => 0,
41 #                                   loop_context_vars => 1 );
42 my ($template, $loggedinuser, $cookie)
43     = get_template_and_user({template_name => "members/member.tmpl",
44                              query => $input,
45                              type => "intranet",
46                              authnotrequired => 0,
47                              flagsrequired => {borrowers => 1},
48                              debug => 1,
49                              });
50
51 my $member=$input->param('member');
52 $member=~ s/\,//g;
53
54 my $env;
55 my ($count,$results)=BornameSearch($env,$member,'web');
56
57 my @resultsdata;
58 for (my $i=0; $i < $count; $i++){
59   #find out stats
60   my ($od,$issue,$fines)=borrdata2($env,$results->[$i]{'borrowernumber'});
61
62   my %row = (
63         borrowernumber => $results->[$i]{'borrowernumber'},
64         cardnumber => $results->[$i]{'cardnumber'},
65         surname => $results->[$i]{'surname'},
66         firstname => $results->[$i]{'firstname'},
67         categorycode => $results->[$i]{'categorycode'},
68         streetaddress => $results->[$i]{'streetaddress'},
69         city => $results->[$i]{'city'},
70         odissue => "$od/$issue",
71         fines => $fines,
72         borrowernotes => $results->[$i]{'borrowernotes'});
73   push(@resultsdata, \%row);
74 }
75
76 $template->param( startmenumember => join ('', startmenu('member')),
77                         endmenumember   => join ('', endmenu('member')),
78                         member          => $member,
79                         resultsloop     => \@resultsdata );
80
81 print $input->header(-cookie => $cookie),$template->output;