projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'patch-18' of https://github.com/gjones2/Freeside
[freeside.git]
/
FS
/
FS
/
cust_main
/
Search.pm
diff --git
a/FS/FS/cust_main/Search.pm
b/FS/FS/cust_main/Search.pm
index
f799b51
..
7dbb7a8
100644
(file)
--- a/
FS/FS/cust_main/Search.pm
+++ b/
FS/FS/cust_main/Search.pm
@@
-646,6
+646,16
@@
sub search {
if $params->{'with_email'};
##
if $params->{'with_email'};
##
+ # "with postal mail invoices" checkbox
+ ##
+
+ push @where,
+ "EXISTS ( SELECT 1 FROM cust_main_invoice
+ WHERE cust_main_invoice.custnum = cust_main.custnum
+ AND dest = 'POST' )"
+ if $params->{'POST'};
+
+ ##
# "without postal mail invoices" checkbox
##
# "without postal mail invoices" checkbox
##
@@
-847,7
+857,8
@@
sub search {
if ($params->{'flattened_pkgs'}) {
#my $pkg_join = '';
if ($params->{'flattened_pkgs'}) {
#my $pkg_join = '';
- $addl_from .= ' LEFT JOIN cust_pkg USING ( custnum ) ';
+ $addl_from .=
+ ' LEFT JOIN cust_pkg ON ( cust_main.custnum = cust_pkg.custnum ) ';
if ($dbh->{Driver}->{Name} eq 'Pg') {
if ($dbh->{Driver}->{Name} eq 'Pg') {
@@
-943,6
+954,11
@@
sub fuzzy_search {
my @cust_main = ();
my @cust_main = ();
+ my @fuzzy_mod = 'i';
+ my $conf = new FS::Conf;
+ my $fuzziness = $conf->config('fuzzy-fuzziness');
+ push @fuzzy_mod, $fuzziness if $fuzziness;
+
check_and_rebuild_fuzzyfiles();
foreach my $field ( keys %$fuzzy ) {
check_and_rebuild_fuzzyfiles();
foreach my $field ( keys %$fuzzy ) {
@@
-950,7
+966,7
@@
sub fuzzy_search {
next unless scalar(@$all);
my %match = ();
next unless scalar(@$all);
my %match = ();
- $match{$_}=1 foreach ( amatch( $fuzzy->{$field},
['i']
, @$all ) );
+ $match{$_}=1 foreach ( amatch( $fuzzy->{$field},
\@fuzzy_mod
, @$all ) );
next if !keys(%match);
my $in_matches = 'IN (' .
next if !keys(%match);
my $in_matches = 'IN (' .