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;
36 my ($template, $loggedinuser, $cookie);
38 ($template, $loggedinuser, $cookie)
39 = get_template_and_user({template_name => "members/guarantor_search.tmpl",
43 flagsrequired => {borrowers => 1},
47 my $theme = $input->param('theme') || "default";
48 # only used if allowthemeoverride is set
51 my $member=$input->param('member');
52 my $orderby=$input->param('orderby');
53 $orderby = "surname,firstname" unless $orderby;
54 $member =~ s/,//g; #remove any commas from search string
57 $template->param(results=>0);
59 $template->param(results=>1);
68 if(length($member) == 1)
70 ($count,$results)=GuarantornameSearch($env,$member,$orderby,"simple");
74 ($count,$results)=GuarantornameSearch($env,$member,$orderby,"advanced");
76 for (my $i=0; $i < $count; $i++){
78 my ($od,$issue,$fines)=borrdata2($env,$results->[$i]{'borrowerid'});
81 background => $background,
83 borrowernumber => $results->[$i]{'borrowernumber'},
84 cardnumber => $results->[$i]{'cardnumber'},
85 surname => $results->[$i]{'surname'},
86 firstname => $results->[$i]{'firstname'},
87 categorycode => $results->[$i]{'categorycode'},
88 address => $results->[$i]{'address'},
89 city => $results->[$i]{'city'},
90 branchcode => $results->[$i]{'branchcode'},
93 dateofbirth =>format_date($results->[$i]{'dateofbirth'}),
96 odissue => "$od/$issue",
98 borrowernotes => $results->[$i]{'borrowernotes'});
99 if ( $background ) { $background = 0; } else {$background = 1; }
100 push(@resultsdata, \%row);
105 numresults => $count,
107 resultsloop => \@resultsdata );
109 output_html_with_http_headers $input, $cookie, $template->output;