X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FSearch.pm;h=ef106b560bdd4e4cc6778e11f90d7cccb0cfa996;hp=677a3e5c7366c8bbb651f79b59733d07f812edc0;hb=2c04f1df05a1b14d9539bbae97275c1d3a0995e2;hpb=a023312fbe3f64d119852581a295945b11ef4575 diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index 677a3e5c7..ef106b560 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',