$agentnum = $1;
push @where, "cust_main.agentnum = $agentnum";
}
+
+# select svcdb
+
+if ( $cgi->param('svcdb') =~ /^(\w+)$/ ) {
+ my $svcdb = $1;
+ push @where, "EXISTS( SELECT 1 FROM $svcdb LEFT JOIN cust_svc USING ( svcnum )
+ LEFT JOIN cust_pkg USING ( pkgnum )
+ WHERE cust_pkg.custnum = cust_main.custnum
+ )";
+}
+
my $where = scalar(@where) ? 'WHERE '. join(' AND ', @where) : '';
# bill zip vs ship zip
</TR>
<TR>
- <TD ALIGN="right">Show customers with status:</TD>
+ <TD ALIGN="right">Show customers with status</TD>
<TD>
<SELECT NAME="status">
<OPTION VALUE="">all
</TD>
</TR>
+ <TR>
+ <TD ALIGN="right">Limit to customers with provisioned service</TD>
+ <TD>
+ <SELECT NAME="svcdb">
+ <OPTION VALUE="">(no)
+ <OPTION VALUE="svc_acct">Account (svc_acct)
+ <OPTION VALUE="svc_broadband">Broadband service (svc_broadband)
+ <OPTION VALUE="svc_domain">Domain (svc_domain)
+ <OPTION VALUE="svc_external">External service (svc_external)
+ <OPTION VALUE="svc_forward">Mail forward (svc_foward)
+ <OPTION VALUE="svc_pbx">PBX (svc_pbx)
+ <OPTION VALUE="svc_phone">Phone number (svc_phone)
+ <OPTION VALUE="svc_www">Hosting (svc_www)
+ </SELECT>
+ </TD>
+ </TR>
+
<% include( '/elements/tr-select-agent.html',
'curr_value' => scalar( $cgi->param('agentnum') ),
'label' => 'For agent: ',