Bug 5177 Selecting default sort result by syspref
[koha.git] / members / guarantor_search.pl
index 4d20b3f..d25d71f 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/perl
 
-# $Id$
 
 # script to find a guarantor
 
 # 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;
-use C4::Search;
-use HTML::Template;
-#op
-use C4::Date;
+use C4::Dates qw/format_date/;
 use C4::Members;
 
 my $input = new CGI;
@@ -58,7 +54,6 @@ if ($member eq ''){
 }else{
                $template->param(results=>1);
 }      
-my $env;
 
 my ($count,$results);
 my @resultsdata;
@@ -67,16 +62,16 @@ my $background = 0;
 if ($member ne ''){
        if(length($member) == 1)
        {
-               ($count,$results)=GuarantornameSearch($env,$member,$orderby,"simple");
+               ($count,$results)=SearchMember($member,$orderby,"simple",'A');
        }
        else
        {
-               ($count,$results)=GuarantornameSearch($env,$member,$orderby,"advanced");
+               ($count,$results)=SearchMember($member,$orderby,"advanced",'A');
        }
        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,
                count => $i+1,
@@ -85,10 +80,13 @@ if ($member ne ''){
                surname => $results->[$i]{'surname'},
                firstname => $results->[$i]{'firstname'},
                categorycode => $results->[$i]{'categorycode'},
+               streetnumber => $results->[$i]{'streetnumber'},
                address => $results->[$i]{'address'},
                city => $results->[$i]{'city'},
+               zipcode => $results->[$i]{'zipcode'},
+               country => $results->[$i]{'country'},
                branchcode => $results->[$i]{'branchcode'},
-               
+               guarantorinfo =>$guarantorinfo,
                #op
                dateofbirth =>format_date($results->[$i]{'dateofbirth'}),
                #fi op