5 # script to find a guarantor
7 # Copyright 2006 OUEST PROVENCE
9 # This file is part of Koha.
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA 02111-1307 USA
34 my ($template, $loggedinuser, $cookie);
36 ($template, $loggedinuser, $cookie)
37 = get_template_and_user({template_name => "members/guarantor_search.tmpl",
41 flagsrequired => {borrowers => 1},
45 my $theme = $input->param('theme') || "default";
46 # only used if allowthemeoverride is set
49 my $member=$input->param('member');
50 my $orderby=$input->param('orderby');
51 $orderby = "surname,firstname" unless $orderby;
52 $member =~ s/,//g; #remove any commas from search string
55 $template->param(results=>0);
57 $template->param(results=>1);
65 if(length($member) == 1)
67 ($count,$results)=SearchMember($member,$orderby,"simple",'A');
71 ($count,$results)=SearchMember($member,$orderby,"advanced",'A');
73 for (my $i=0; $i < $count; $i++){
75 my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowerid'});
76 my $guarantorinfo=uc($results->[$i]{'surname'})." , ".ucfirst($results->[$i]{'firstname'});
78 background => $background,
80 borrowernumber => $results->[$i]{'borrowernumber'},
81 cardnumber => $results->[$i]{'cardnumber'},
82 surname => $results->[$i]{'surname'},
83 firstname => $results->[$i]{'firstname'},
84 categorycode => $results->[$i]{'categorycode'},
85 address => $results->[$i]{'address'},
86 city => $results->[$i]{'city'},
87 branchcode => $results->[$i]{'branchcode'},
88 guarantorinfo =>$guarantorinfo,
90 dateofbirth =>format_date($results->[$i]{'dateofbirth'}),
93 odissue => "$od/$issue",
95 borrowernotes => $results->[$i]{'borrowernotes'});
96 if ( $background ) { $background = 0; } else {$background = 1; }
97 push(@resultsdata, \%row);
102 numresults => $count,
104 resultsloop => \@resultsdata );
106 output_html_with_http_headers $input, $cookie, $template->output;