[freeside-commits] branch master updated. b77fc573901a0ae334b9b382e00ca9db60401d16

Ivan ivan at 420.am
Fri Nov 15 15:58:33 PST 2013


The branch, master has been updated
       via  b77fc573901a0ae334b9b382e00ca9db60401d16 (commit)
      from  75873f3e9e5f1da270589fd3dadba593d2b92d01 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b77fc573901a0ae334b9b382e00ca9db60401d16
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Nov 15 15:58:32 2013 -0800

    fix search performance (and possibly results?), RT#25985, RT#25687

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 215fdc2..b143861 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,

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main/Search.pm |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list