[freeside-commits] branch master updated. 0c5e4f76b7ceb2c47657ca75f54fb4c0c82152aa
Ivan
ivan at 420.am
Mon Jun 5 14:21:03 PDT 2017
The branch, master has been updated
via 0c5e4f76b7ceb2c47657ca75f54fb4c0c82152aa (commit)
from e3c112ceb504f994e4d53726b2ed6d7a3945fa2a (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 0c5e4f76b7ceb2c47657ca75f54fb4c0c82152aa
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon Jun 5 14:21:02 2017 -0700
perform 3 character substring searches if you have 'List all customers', RT#75012, RT#76155
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 0eb0020..d668094 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -356,10 +356,14 @@ sub smart_search {
#still some false laziness w/search (was search/cust_main.cgi)
+ my $min_len =
+ $FS::CurrentUser::CurrentUser->access_right('List all customers')
+ ? 3 : 4;
+
#substring
my @company_hashrefs = ();
- if ( length($value) >= 4 ) {
+ if ( length($value) >= $min_len ) {
@company_hashrefs = (
{ 'company' => { op=>'ILIKE', value=>"%$value%" }, },
{ 'ship_company' => { op=>'ILIKE', value=>"%$value%" }, },
@@ -375,7 +379,7 @@ sub smart_search {
},
);
- } elsif ( length($value) >= 4 ) {
+ } elsif ( length($value) >= $min_len ) {
@hashrefs = (
{ 'first' => { op=>'ILIKE', value=>"%$value%" }, },
@@ -396,7 +400,7 @@ sub smart_search {
}
- if ( $conf->exists('address1-search') && length($value) >= 4 ) {
+ if ( $conf->exists('address1-search') && length($value) >= $min_len ) {
push @cust_main, qsearch( {
table => 'cust_main',
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_main/Search.pm | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
More information about the freeside-commits
mailing list