From e37d775d5c2ef42b30f0c0b0bf50fe80d33c8e0f Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 17 Feb 2005 12:46:41 +0000 Subject: [PATCH] in member search, adding an option to order result by name or cardnumber --- C4/Search.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 92c9a797fd..a5cdf2e87c 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1793,14 +1793,14 @@ C<$count> is the number of elements in C<$borrowers>. #used by member enquiries from the intranet #called by member.pl sub BornameSearch { - my ($env,$searchstring,$type)=@_; + my ($env,$searchstring,$orderby,$type)=@_; my $dbh = C4::Context->dbh; my $query = ""; my $count; my @data; my @bind=(); if($type eq "simple") # simple search for one letter only { - $query="Select * from borrowers where surname like ? order by surname,firstname"; + $query="Select * from borrowers where surname like ? order by $orderby"; @bind=("$searchstring%"); } else # advanced search looking in surname, firstname and othernames @@ -1821,13 +1821,14 @@ sub BornameSearch { push(@bind,"$data[$i]%","% $data[$i]%","$data[$i]%","% $data[$i]%","$data[$i]%","% $data[$i]%"); # FIXME - .= <prepare($query); + warn "Q $orderby : $query"; $sth->execute(@bind); my @results; my $cnt=$sth->rows;