projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT#41394: Add advertising source to customer fields selection
[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
097f2fb
..
8e6d185
100644
(file)
--- a/
FS/FS/cust_main/Search.pm
+++ b/
FS/FS/cust_main/Search.pm
@@
-531,10
+531,12
@@
sub email_search {
if $DEBUG;
push @cust_main,
if $DEBUG;
push @cust_main,
- map $_->cust_main,
+ map { $_->cust_main }
+ map { $_->cust_contact }
+ map { $_->contact }
qsearch( {
qsearch( {
- 'table' => 'c
ust_main_invoice
',
- 'hashref' => { '
dest
' => $email },
+ 'table' => 'c
ontact_email
',
+ 'hashref' => { '
emailaddress
' => $email },
}
);
}
);
@@
-808,30
+810,24
@@
sub search {
##
push @where,
##
push @where,
- 'EXISTS ( SELECT 1 FROM c
ust_main_invoice
- WHERE cust_main_invoice.custnum = cust_main.custnum
- AND length(dest) > 5
- )'
# AND dest LIKE '%@%'
+ 'EXISTS ( SELECT 1 FROM c
ontact_email
+ JOIN cust_contact USING (contactnum)
+ WHERE cust_contact.custnum = cust_main.custnum
+ )'
if $params->{'with_email'};
##
# "with postal mail invoices" checkbox
##
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' )"
+ push @where, "cust_main.postal_invoice = 'Y'"
if $params->{'POST'};
##
# "without postal mail invoices" checkbox
##
if $params->{'POST'};
##
# "without postal mail invoices" checkbox
##
- push @where,
- "NOT EXISTS ( SELECT 1 FROM cust_main_invoice
- WHERE cust_main_invoice.custnum = cust_main.custnum
- AND dest = 'POST' )"
+ push @where, "cust_main.postal_invoice IS NULL"
if $params->{'no_POST'};
##
if $params->{'no_POST'};
##
@@
-1017,6
+1013,10
@@
sub search {
'ON (cust_main.'.$pre.'locationnum = '.$pre.'location.locationnum) ';
}
'ON (cust_main.'.$pre.'locationnum = '.$pre.'location.locationnum) ';
}
+ # always make referral available in results
+ # (maybe we should be using FS::UI::Web::join_cust_main instead?)
+ $addl_from .= ' LEFT JOIN part_referral ON (cust_main.refnum = part_referral.refnum) ';
+
my $count_query = "SELECT COUNT(*) FROM cust_main $addl_from $extra_sql";
my @select = (
my $count_query = "SELECT COUNT(*) FROM cust_main $addl_from $extra_sql";
my @select = (