Bug Fixing Search By initials incorrect

Adding a research scope : field_start_with
Using this kind of research if searching by initial
This commit is contained in:
Henri-Damien LAURENT 2010-01-15 16:27:31 +01:00
parent dc9991d9b4
commit 7540dda2eb
2 changed files with 8 additions and 3 deletions

View file

@ -431,9 +431,13 @@ sub _Process_Operands{
push @tmpkeys,(" $field LIKE ? ");
push @localvaluesextended,("\%$operand\%") ;
}
if ($searchtype eq "field_start_with"){
push @tmpkeys,("$field LIKE ?");
push @localvaluesextended, ("$operand\%") ;
}
if ($searchtype eq "start_with"){
push @tmpkeys,(" $field LIKE ? ","$field LIKE ?");
push @localvaluesextended, ("\% $operand\%","$operand\%") ;
push @tmpkeys,("$field LIKE ?","$field LIKE ?");
push @localvaluesextended, ("$operand\%", " $operand\%") ;
}
push @values,@localvaluesextended;
}

View file

@ -103,7 +103,8 @@ 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,\@orderby,undef,undef,["firstname","surname","email","othernames","cardnumber","userid"],"start_with" ) if (@searchpatron);
my $search_scope=($quicksearch?"field_start_with":"start_with");
($results)=Search(\@searchpatron,\@orderby,undef,undef,["firstname","surname","email","othernames","cardnumber","userid"],$search_scope ) if (@searchpatron);
if ($results){
$count =scalar(@$results);
}