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
27 use C4::Interface::CGI::Output;
35 my ($template, $loggedinuser, $cookie);
37 ($template, $loggedinuser, $cookie)
38 = get_template_and_user({template_name => "members/guarantor_search.tmpl",
42 flagsrequired => {borrowers => 1},
46 my $theme = $input->param('theme') || "default";
47 # only used if allowthemeoverride is set
50 my $member=$input->param('member');
51 my $orderby=$input->param('orderby');
52 $orderby = "surname,firstname" unless $orderby;
53 $member =~ s/,//g; #remove any commas from search string
56 $template->param(results=>0);
58 $template->param(results=>1);
66 if(length($member) == 1)
68 ($count,$results)=GuarantornameSearch($member,$orderby,"simple");
72 ($count,$results)=GuarantornameSearch($member,$orderby,"advanced");
74 for (my $i=0; $i < $count; $i++){
76 my ($od,$issue,$fines)=borrdata2($results->[$i]{'borrowerid'});
77 my $guarantorinfo=uc($results->[$i]{'surname'})." , ".ucfirst($results->[$i]{'firstname'});
79 background => $background,
81 borrowernumber => $results->[$i]{'borrowernumber'},
82 cardnumber => $results->[$i]{'cardnumber'},
83 surname => $results->[$i]{'surname'},
84 firstname => $results->[$i]{'firstname'},
85 categorycode => $results->[$i]{'categorycode'},
86 address => $results->[$i]{'address'},
87 city => $results->[$i]{'city'},
88 branchcode => $results->[$i]{'branchcode'},
89 guarantorinfo =>$guarantorinfo,
91 dateofbirth =>format_date($results->[$i]{'dateofbirth'}),
94 odissue => "$od/$issue",
96 borrowernotes => $results->[$i]{'borrowernotes'});
97 if ( $background ) { $background = 0; } else {$background = 1; }
98 push(@resultsdata, \%row);
103 numresults => $count,
105 resultsloop => \@resultsdata );
107 output_html_with_http_headers $input, $cookie, $template->output;