5 #script to do a borrower enquiery/brin up borrower details etc
6 #written 20/12/99 by chris@katipo.co.nz
9 # Copyright 2000-2002 Katipo Communications
11 # This file is part of Koha.
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
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.
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
34 my $quicksearch = $input->param('quicksearch');
35 my ($template, $loggedinuser, $cookie);
37 ($template, $loggedinuser, $cookie)
38 = get_template_and_user({template_name => "members/member-quicksearch-results.tmpl",
42 flagsrequired => {borrowers => 1},
46 ($template, $loggedinuser, $cookie)
47 = get_template_and_user({template_name => "members/member.tmpl",
51 flagsrequired => {borrowers => 1},
55 my $theme = $input->param('theme') || "default";
56 # only used if allowthemeoverride is set
57 #my %tmpldata = pathtotemplate ( template => 'member.tmpl', theme => $theme, language => 'fi' );
58 # FIXME - Error-checking
59 #my $template = HTML::Template->new( filename => $tmpldata{'path'},
60 # die_on_bad_params => 0,
61 # loop_context_vars => 1 );
64 my $member=$input->param('member');
65 my $orderby=$input->param('orderby');
66 $orderby = "surname,firstname" unless $orderby;
67 $member =~ s/,//g; #remove any commas from search string
72 if(length($member) == 1)
74 ($count,$results)=SearchMember($member,$orderby,"simple");
78 ($count,$results)=SearchMember($member,$orderby,"advanced");
84 for (my $i=0; $i < $count; $i++){
86 my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowernumber'});
89 background => $background,
91 borrowernumber => $results->[$i]{'borrowernumber'},
92 cardnumber => $results->[$i]{'cardnumber'},
93 surname => $results->[$i]{'surname'},
94 firstname => $results->[$i]{'firstname'},
95 categorycode => $results->[$i]{'categorycode'},
96 category_type => $results->[$i]{'category_type'},
97 category_description => $results->[$i]{'description'},
98 streetaddress => $results->[$i]{'streetaddress'},
99 city => $results->[$i]{'city'},
100 branchcode => $results->[$i]{'branchcode'},
103 odissue => "$od/$issue",
104 fines => sprintf("%.2f",$fines),
105 borrowernotes => $results->[$i]{'borrowernotes'},
106 sort1 => $results->[$i]{'sort1'},
107 sort2 => $results->[$i]{'sort2'},
109 if ( $background ) { $background = 0; } else {$background = 1; }
110 push(@resultsdata, \%row);
116 numresults => $count,
117 resultsloop => \@resultsdata,
118 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
119 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
120 IntranetNav => C4::Context->preference("IntranetNav"),
123 output_html_with_http_headers $input, $cookie, $template->output;