X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=members%2Fguarantor_search.pl;h=59ea5b19de6aee18be2c42fc2d57c19bcb31c764;hb=5d4d33b22d72e16a4f6a4579ea4c2d98dfa091ab;hp=e942ebbdd3bb9077f8cf8bf173adacef04ba1231;hpb=a3999812e691110f2e16fffd91ce0ed82d69178c;p=koha_fer diff --git a/members/guarantor_search.pl b/members/guarantor_search.pl index e942ebbdd3..59ea5b19de 100755 --- a/members/guarantor_search.pl +++ b/members/guarantor_search.pl @@ -1,6 +1,5 @@ #!/usr/bin/perl -# $Id$ # script to find a guarantor @@ -17,18 +16,16 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; +#use warnings; FIXME - Bug 2505 use C4::Auth; use C4::Output; -use C4::Interface::CGI::Output; use CGI; - -#op -use C4::Date; +use C4::Dates qw/format_date/; use C4::Members; my $input = new CGI; @@ -49,6 +46,7 @@ my $theme = $input->param('theme') || "default"; my $member=$input->param('member'); my $orderby=$input->param('orderby'); +my $category_type=$input->param('category_type'); $orderby = "surname,firstname" unless $orderby; $member =~ s/,//g; #remove any commas from search string $member =~ s/\*/%/g; @@ -57,24 +55,23 @@ if ($member eq ''){ }else{ $template->param(results=>1); } -my $env; + +my $search_category = 'A'; +if ($category_type eq 'P'){ + $search_category = 'I'; +} my ($count,$results); my @resultsdata; my $background = 0; if ($member ne ''){ - if(length($member) == 1) - { - ($count,$results)=GuarantornameSearch($env,$member,$orderby,"simple"); - } - else - { - ($count,$results)=GuarantornameSearch($env,$member,$orderby,"advanced"); - } + $results = Search({''=>$member, category_type=>$search_category},$orderby); + $count = $results ? @$results : 0; + for (my $i=0; $i < $count; $i++){ #find out stats - my ($od,$issue,$fines)=borrdata2($env,$results->[$i]{'borrowerid'}); + my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowerid'}); my $guarantorinfo=uc($results->[$i]{'surname'})." , ".ucfirst($results->[$i]{'firstname'}); my %row = ( background => $background, @@ -84,8 +81,13 @@ if ($member ne ''){ surname => $results->[$i]{'surname'}, firstname => $results->[$i]{'firstname'}, categorycode => $results->[$i]{'categorycode'}, + streetnumber => $results->[$i]{'streetnumber'}, address => $results->[$i]{'address'}, + address2 => $results->[$i]{'address2'}, city => $results->[$i]{'city'}, + state => $results->[$i]{'state'}, + zipcode => $results->[$i]{'zipcode'}, + country => $results->[$i]{'country'}, branchcode => $results->[$i]{'branchcode'}, guarantorinfo =>$guarantorinfo, #op @@ -102,7 +104,7 @@ if ($member ne ''){ $template->param( member => $member, numresults => $count, - + category_type => $category_type, resultsloop => \@resultsdata ); -output_html_with_http_headers $input, $cookie, $template->output; \ No newline at end of file +output_html_with_http_headers $input, $cookie, $template->output;