projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a023312
)
don't allow two character substring searches, RT#75012
author
Ivan Kohler
<ivan@freeside.biz>
Mon, 6 Mar 2017 17:25:12 +0000
(09:25 -0800)
committer
Ivan Kohler
<ivan@freeside.biz>
Thu, 27 Apr 2017 18:48:04 +0000
(11:48 -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
677a3e5
..
ef106b5
100644
(file)
--- a/
FS/FS/cust_main/Search.pm
+++ b/
FS/FS/cust_main/Search.pm
@@
-358,13
+358,15
@@
sub smart_search {
#substring
#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 = ();
my @hashrefs = ();
-
if ( $first && $last ) {
@hashrefs = (
if ( $first && $last ) {
@hashrefs = (
@@
-373,12
+375,13
@@
sub smart_search {
},
);
},
);
- } els
e
{
+ } els
if ( length($value) >= 3 )
{
@hashrefs = (
{ 'first' => { op=>'ILIKE', value=>"%$value%" }, },
{ 'last' => { op=>'ILIKE', value=>"%$value%" }, },
);
@hashrefs = (
{ 'first' => { op=>'ILIKE', value=>"%$value%" }, },
{ 'last' => { op=>'ILIKE', value=>"%$value%" }, },
);
+
}
foreach my $hashref ( @company_hashrefs, @hashrefs ) {
}
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',
push @cust_main, qsearch( {
table => 'cust_main',