summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-11-15 15:58:32 -0800
committerIvan Kohler <ivan@freeside.biz>2013-11-15 15:58:32 -0800
commitb77fc573901a0ae334b9b382e00ca9db60401d16 (patch)
treecbc8fe06a7909970ae33cd442c7e4e6b274732e4
parent75873f3e9e5f1da270589fd3dadba593d2b92d01 (diff)
fix search performance (and possibly results?), RT#25985, RT#25687
-rw-r--r--FS/FS/cust_main/Search.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 215fdc2bc..b1438619b 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -358,28 +358,30 @@ sub smart_search {
#substring
- my @hashrefs = (
+ my @company_hashrefs = (
{ 'company' => { op=>'ILIKE', value=>"%$value%" }, },
{ 'ship_company' => { op=>'ILIKE', value=>"%$value%" }, },
);
+ my @hashrefs = ();
+
if ( $first && $last ) {
- push @hashrefs,
+ @hashrefs = (
{ 'first' => { op=>'ILIKE', value=>"%$first%" },
'last' => { op=>'ILIKE', value=>"%$last%" },
},
- ;
+ );
} else {
- push @hashrefs,
+ @hashrefs = (
{ 'first' => { op=>'ILIKE', value=>"%$value%" }, },
{ 'last' => { op=>'ILIKE', value=>"%$value%" }, },
- ;
+ );
}
- foreach my $hashref ( @hashrefs ) {
+ foreach my $hashref ( @company_hashrefs, @hashrefs ) {
push @cust_main, qsearch( {
'table' => 'cust_main',
@@ -405,8 +407,6 @@ sub smart_search {
#contact substring
- shift @hashrefs; #no company column in contact table
-
foreach my $hashref ( @hashrefs ) {
push @cust_main,