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
27 use C4
::Dates qw
/format_date/;
31 my ($template, $loggedinuser, $cookie);
33 ($template, $loggedinuser, $cookie)
34 = get_template_and_user
({template_name
=> "members/guarantor_search.tmpl",
38 flagsrequired
=> {borrowers
=> 1},
42 my $theme = $input->param('theme') || "default";
43 # only used if allowthemeoverride is set
46 my $member=$input->param('member');
47 my $orderby=$input->param('orderby');
48 $orderby = "surname,firstname" unless $orderby;
49 $member =~ s/,//g; #remove any commas from search string
52 $template->param(results
=>0);
54 $template->param(results
=>1);
62 if(length($member) == 1)
64 ($count,$results)=SearchMember
($member,$orderby,"simple",'A');
68 ($count,$results)=SearchMember
($member,$orderby,"advanced",'A');
70 for (my $i=0; $i < $count; $i++){
72 my ($od,$issue,$fines)=GetMemberIssuesAndFines
($results->[$i]{'borrowerid'});
73 my $guarantorinfo=uc($results->[$i]{'surname'})." , ".ucfirst($results->[$i]{'firstname'});
75 background
=> $background,
77 borrowernumber
=> $results->[$i]{'borrowernumber'},
78 cardnumber
=> $results->[$i]{'cardnumber'},
79 surname
=> $results->[$i]{'surname'},
80 firstname
=> $results->[$i]{'firstname'},
81 categorycode
=> $results->[$i]{'categorycode'},
82 address
=> $results->[$i]{'address'},
83 city
=> $results->[$i]{'city'},
84 branchcode
=> $results->[$i]{'branchcode'},
85 guarantorinfo
=>$guarantorinfo,
87 dateofbirth
=>format_date
($results->[$i]{'dateofbirth'}),
90 odissue
=> "$od/$issue",
92 borrowernotes
=> $results->[$i]{'borrowernotes'});
93 if ( $background ) { $background = 0; } else {$background = 1; }
94 push(@resultsdata, \
%row);
101 resultsloop
=> \
@resultsdata );
103 output_html_with_http_headers
$input, $cookie, $template->output;