[freeside-commits] branch FREESIDE_4_BRANCH updated. 497b5e7d5bae906216c96d3d59a835779f3ff353

Ivan ivan at 420.am
Thu Apr 27 11:47:42 PDT 2017


The branch, FREESIDE_4_BRANCH has been updated
       via  497b5e7d5bae906216c96d3d59a835779f3ff353 (commit)
       via  01c18fe8ef22a4f364d1d0f109e9a336d10968b9 (commit)
      from  693bd5cfef9f51ee6115159c369b728d269455ab (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 497b5e7d5bae906216c96d3d59a835779f3ff353
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 c5a87eb..4473aed 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 01c18fe8ef22a4f364d1d0f109e9a336d10968b9
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 |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list