[freeside-commits] branch master updated. 9e878943532b9ecb84bac1db76c05cf9bc09d2cc

Ivan ivan at 420.am
Mon Mar 6 09:27:16 PST 2017


The branch, master has been updated
       via  9e878943532b9ecb84bac1db76c05cf9bc09d2cc (commit)
       via  ee5061a32e7b9054a982f3ed5260a5946e6b65a6 (commit)
      from  c56b3fce5486b08d986743d1c2a9cc2e6aafa5bc (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 9e878943532b9ecb84bac1db76c05cf9bc09d2cc
Merge: ee5061a c56b3fc
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Mar 6 09:27:01 2017 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit ee5061a32e7b9054a982f3ed5260a5946e6b65a6
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Mar 6 09:25:12 2017 -0800

    don't allow two character substring searches, RT#75012

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 14dd4b4..c5a87eb 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -358,13 +358,15 @@ sub smart_search {
 
       #substring
 
-      my @company_hashrefs = (
-        { 'company'      => { op=>'ILIKE', value=>"%$value%" }, },
-        { 'ship_company' => { op=>'ILIKE', value=>"%$value%" }, },
-      );
+      my @company_hashrefs = ();
+      if ( length($value) >= 3 ) {
+        @company_hashrefs = (
+          { 'company'      => { op=>'ILIKE', value=>"%$value%" }, },
+          { 'ship_company' => { op=>'ILIKE', value=>"%$value%" }, },
+        );
+      }
 
       my @hashrefs = ();
-
       if ( $first && $last ) {
 
         @hashrefs = (
@@ -373,12 +375,13 @@ sub smart_search {
           },
         );
 
-      } else {
+      } elsif ( length($value) >= 3 ) {
 
         @hashrefs = (
           { 'first'        => { op=>'ILIKE', value=>"%$value%" }, },
           { 'last'         => { op=>'ILIKE', value=>"%$value%" }, },
         );
+
       }
 
       foreach my $hashref ( @company_hashrefs, @hashrefs ) {
@@ -393,7 +396,7 @@ sub smart_search {
 
       }
 
-      if ( $conf->exists('address1-search') ) {
+      if ( $conf->exists('address1-search') && length($value) >= 3 ) {
 
         push @cust_main, qsearch( {
           table     => 'cust_main',

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

Summary of changes:
 FS/FS/cust_main/Search.pm |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)




More information about the freeside-commits mailing list