summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-03-06 09:25:12 -0800
committerIvan Kohler <ivan@freeside.biz>2017-04-27 11:47:37 -0700
commit01c18fe8ef22a4f364d1d0f109e9a336d10968b9 (patch)
tree43ac8d668c1069d9373b9267aab4bbf84c8c0363
parent693bd5cfef9f51ee6115159c369b728d269455ab (diff)
don't allow two character substring searches, RT#75012
-rw-r--r--FS/FS/cust_main/Search.pm17
1 files changed, 10 insertions, 7 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 14dd4b469..c5a87eb04 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',