projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e3c112c
)
perform 3 character substring searches if you have 'List all customers', RT#75012...
author
Ivan Kohler
<ivan@freeside.biz>
Mon, 5 Jun 2017 21:21:02 +0000
(14:21 -0700)
committer
Ivan Kohler
<ivan@freeside.biz>
Mon, 5 Jun 2017 21:21:02 +0000
(14:21 -0700)
FS/FS/cust_main/Search.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_main/Search.pm
b/FS/FS/cust_main/Search.pm
index
0eb0020
..
d668094
100644
(file)
--- 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)
#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 = ();
#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%" }, },
@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%" }, },
@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',
push @cust_main, qsearch( {
table => 'cust_main',