summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-11-15 15:58:34 -0800
committerIvan Kohler <ivan@freeside.biz>2013-11-15 15:58:34 -0800
commitbb2c4fd6f87c1bf47ca3fdbf7a2874179ec2673a (patch)
tree4992276d7d7c2817d876de9c9dc98059e9ddc5cf
parent060d5ba818caef48a659ed3c2e6a22b5c3d69d10 (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,