[freeside-commits] branch FREESIDE_3_BRANCH updated. e0a759bb54e95c8b3502b33c3ac691e58de0641b

Ivan ivan at 420.am
Thu Apr 27 11:48:08 PDT 2017


The branch, FREESIDE_3_BRANCH has been updated
       via  e0a759bb54e95c8b3502b33c3ac691e58de0641b (commit)
       via  2c04f1df05a1b14d9539bbae97275c1d3a0995e2 (commit)
      from  a023312fbe3f64d119852581a295945b11ef4575 (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 e0a759bb54e95c8b3502b33c3ac691e58de0641b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Apr 27 11:47:04 2017 -0700

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

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index ef106b5..5c21a8e 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -359,7 +359,7 @@ sub smart_search {
       #substring
 
       my @company_hashrefs = ();
-      if ( length($value) >= 3 ) {
+      if ( length($value) >= 4 ) {
         @company_hashrefs = (
           { 'company'      => { op=>'ILIKE', value=>"%$value%" }, },
           { 'ship_company' => { op=>'ILIKE', value=>"%$value%" }, },
@@ -375,7 +375,7 @@ sub smart_search {
           },
         );
 
-      } elsif ( length($value) >= 3 ) {
+      } elsif ( length($value) >= 4 ) {
 
         @hashrefs = (
           { 'first'        => { op=>'ILIKE', value=>"%$value%" }, },
@@ -396,7 +396,7 @@ sub smart_search {
 
       }
 
-      if ( $conf->exists('address1-search') && length($value) >= 3 ) {
+      if ( $conf->exists('address1-search') && length($value) >= 4 ) {
 
         push @cust_main, qsearch( {
           table     => 'cust_main',
@@ -444,7 +444,8 @@ sub smart_search {
             'contact.first'  => $first }, #
           %fuzopts
         );
-     }
+      }
+
       foreach my $field ( 'first', 'last', 'company', 'ship_company' ) {
         push @cust_main, FS::cust_main::Search->fuzzy_search(
           { $field => $value },

commit 2c04f1df05a1b14d9539bbae97275c1d3a0995e2
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 677a3e5..ef106b5 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 |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list