From c3c732f4bc8e0475d7251bdd2a44b3f23c3f857a Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Fri, 5 Feb 2010 13:08:04 +0000 Subject: [PATCH] Bug 4117 Fix system error in routing slip recepients popup order_by parameter should be an arrayref of hashrefs Have made order surname, firstname asc (see bug 4067) do not generate logged warnings by manipulating undef Signed-off-by: Galen Charlton --- serials/member-search.pl | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/serials/member-search.pl b/serials/member-search.pl index 6009db45da..549067a1dd 100755 --- a/serials/member-search.pl +++ b/serials/member-search.pl @@ -71,8 +71,10 @@ if (C4::Context->preference("AddPatronLists")=~/code/){ my $member=$cgi->param('member'); my $orderby=$cgi->param('orderby'); $orderby = "surname,firstname" unless $orderby; -$member =~ s/,//g; #remove any commas from search string -$member =~ s/\*/%/g; +if (defined $member) { + $member =~ s/,//g; #remove any commas from search string + $member =~ s/\*/%/g; +} my ($count,$results); @@ -86,13 +88,21 @@ $$patron{surname}.="\%" if ($$patron{surname}); my @searchpatron; push @searchpatron, $member if ($member); -push @searchpatron, $patron if (keys %$patron); -my $from= ($startfrom-1)*$resultsperpage; -my $to=$from+$resultsperpage; - #($results)=Search(\@searchpatron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ) if (@searchpatron); - ($results)=Search(\@searchpatron,{surname=>1,firstname=>1},undef,undef,["firstname","surname","email","othernames","cardnumber"],"start_with" ) if (@searchpatron); -if ($results){ - $count =scalar(@$results); +push @searchpatron, $patron if ( keys %$patron ); +my $from = ( $startfrom - 1 ) * $resultsperpage; +my $to = $from + $resultsperpage; +if (@searchpatron) { + ($results) = Search( + \@searchpatron, + [ { surname => 0 }, { firstname => 0 } ], + undef, + undef, + [ "firstname", "surname", "email", "othernames", "cardnumber" ], + "start_with" + ); +} +if ($results) { + $count = scalar(@$results); } my @resultsdata; $to=($count>$to?$to:$count); -- 2.39.5