summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-12-20 01:51:24 -0800
committerIvan Kohler <ivan@freeside.biz>2012-12-20 01:51:24 -0800
commit2ee09c1343daa939da146c102dbca72f0a98d2bf (patch)
treee6a68a0acb76672bc65a1e8e29666a007a32de4f
parent578ec27f71498b63102e4cca204575c01c1f8fa9 (diff)
add "with email address(es)" and "without postal mail invoices" to adv. customer search, RT#20708
-rw-r--r--FS/FS/cust_main/Search.pm21
-rwxr-xr-xhttemplate/search/cust_main.html3
-rwxr-xr-xhttemplate/search/report_cust_main.html10
3 files changed, 33 insertions, 1 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index b07223e..1047890 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -633,6 +633,27 @@ sub search {
if $params->{'with_geocode'};
##
+ # "with email address(es)" checkbox
+ ##
+
+ push @where,
+ 'EXISTS ( SELECT 1 FROM cust_main_invoice
+ WHERE cust_main_invoice.custnum = cust_main.custnum
+ AND length(dest) > 5
+ )' # AND dest LIKE '%@%'
+ if $params->{'with_email'};
+
+ ##
+ # "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' )"
+ if $params->{'no_POST'};
+
+ ##
# dates
##
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index fa79b4d..8b39ea9 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -42,7 +42,8 @@ my %search_hash = ();
#scalars
my @scalars = qw (
agentnum status address zip paydate_year paydate_month invoice_terms
- no_censustract with_geocode custbatch usernum
+ no_censustract with_geocode with_email no_POST
+ custbatch usernum
cancelled_pkgs
cust_fields flattened_pkgs
);
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index 3e7181d..acc49ae 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -169,6 +169,16 @@
% }
<TR>
+ <TD ALIGN="right" VALIGN="center"><% mt('With email address(es)') |h %></TD>
+ <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
+ </TR>
+
+ <TR>
+ <TD ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TD>
+ <TD><INPUT TYPE="checkbox" NAME="no_POST"></TD>
+ </TR>
+
+ <TR>
<TH CLASS="background" COLSPAN=2>&nbsp;</TH>
</TR>