4 # script to find a guarantor
6 # Copyright 2006 OUEST PROVENCE
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA 02111-1307 USA
33 my ($template, $loggedinuser, $cookie);
35 ($template, $loggedinuser, $cookie)
36 = get_template_and_user({template_name => "members/guarantor_search.tmpl",
40 flagsrequired => {borrowers => 1},
44 my $theme = $input->param('theme') || "default";
45 # only used if allowthemeoverride is set
48 my $member=$input->param('member');
49 my $orderby=$input->param('orderby');
50 $orderby = "surname,firstname" unless $orderby;
51 $member =~ s/,//g; #remove any commas from search string
54 $template->param(results=>0);
56 $template->param(results=>1);
64 if(length($member) == 1)
66 ($count,$results)=SearchMember($member,$orderby,"simple",'A');
70 ($count,$results)=SearchMember($member,$orderby,"advanced",'A');
72 for (my $i=0; $i < $count; $i++){
74 my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowerid'});
75 my $guarantorinfo=uc($results->[$i]{'surname'})." , ".ucfirst($results->[$i]{'firstname'});
77 background => $background,
79 borrowernumber => $results->[$i]{'borrowernumber'},
80 cardnumber => $results->[$i]{'cardnumber'},
81 surname => $results->[$i]{'surname'},
82 firstname => $results->[$i]{'firstname'},
83 categorycode => $results->[$i]{'categorycode'},
84 address => $results->[$i]{'address'},
85 city => $results->[$i]{'city'},
86 branchcode => $results->[$i]{'branchcode'},
87 guarantorinfo =>$guarantorinfo,
89 dateofbirth =>format_date($results->[$i]{'dateofbirth'}),
92 odissue => "$od/$issue",
94 borrowernotes => $results->[$i]{'borrowernotes'});
95 if ( $background ) { $background = 0; } else {$background = 1; }
96 push(@resultsdata, \%row);
101 numresults => $count,
103 resultsloop => \@resultsdata );
105 output_html_with_http_headers $input, $cookie, $template->output;