4 #script to do a borrower enquiry/bring up borrower details etc
5 #written 20/12/99 by chris@katipo.co.nz
8 # Copyright 2000-2002 Katipo Communications
10 # This file is part of Koha.
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License along with
22 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 # Suite 330, Boston, MA 02111-1307 USA
33 my $quicksearch = $input->param('quicksearch');
34 my ($template, $loggedinuser, $cookie);
36 ($template, $loggedinuser, $cookie)
37 = get_template_and_user({template_name => "members/member-quicksearch-results.tmpl",
41 flagsrequired => {borrowers => 1},
45 ($template, $loggedinuser, $cookie)
46 = get_template_and_user({template_name => "members/member.tmpl",
50 flagsrequired => {borrowers => 1},
54 my $theme = $input->param('theme') || "default";
55 # only used if allowthemeoverride is set
56 #my %tmpldata = pathtotemplate ( template => 'member.tmpl', theme => $theme, language => 'fi' );
57 # FIXME - Error-checking
58 #my $template = HTML::Template->new( filename => $tmpldata{'path'},
59 # die_on_bad_params => 0,
60 # loop_context_vars => 1 );
63 my $member=$input->param('member');
64 my $orderby=$input->param('orderby');
65 $orderby = "surname,firstname" unless $orderby;
66 $member =~ s/,//g; #remove any commas from search string
71 if(length($member) == 1)
73 ($count,$results)=SearchMember($member,$orderby,"simple");
77 ($count,$results)=SearchMember($member,$orderby,"advanced");
83 for (my $i=0; $i < $count; $i++){
85 my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowernumber'});
90 borrowernumber => $results->[$i]{'borrowernumber'},
91 cardnumber => $results->[$i]{'cardnumber'},
92 surname => $results->[$i]{'surname'},
93 firstname => $results->[$i]{'firstname'},
94 categorycode => $results->[$i]{'categorycode'},
95 category_type => $results->[$i]{'category_type'},
96 category_description => $results->[$i]{'description'},
97 address => $results->[$i]{'address'},
98 address2 => $results->[$i]{'address2'},
99 city => $results->[$i]{'city'},
100 zipcode => $results->[$i]{'zipcode'},
101 branchcode => $results->[$i]{'branchcode'},
104 odissue => "$od/$issue",
105 fines => sprintf("%.2f",$fines),
106 borrowernotes => $results->[$i]{'borrowernotes'},
107 sort1 => $results->[$i]{'sort1'},
108 sort2 => $results->[$i]{'sort2'},
110 if ( $toggle ) { $toggle = 0; } else {$toggle = 1; }
111 push(@resultsdata, \%row);
117 numresults => $count,
118 resultsloop => \@resultsdata,
121 output_html_with_http_headers $input, $cookie, $template->output;