filter by customer class on all financial reports, #20573
[freeside.git] / httemplate / search / cust_bill_pkg.cgi
index 11a5095..42722b1 100644 (file)
@@ -120,6 +120,8 @@ Filtering parameters:
 
 - refnum: Filter on customer reference source.
 
+- cust_classnum: Filter on customer class.
+
 - classnum: Filter on package class.
 
 - use_override: Apply "classnum" and "taxclass" filtering based on the 
@@ -258,6 +260,13 @@ if ( $cgi->param('refnum') =~ /^(\d+)$/ ) {
   push @where, "cust_main.refnum = $1";
 }
 
+# cust_classnum
+if ( $cgi->param('cust_classnum') ) {
+  my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+  push @where, 'cust_main.classnum IN('.join(',',@classnums).')'
+    if @classnums;
+}
+
 # custnum
 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
   push @where, "cust_main.custnum = $1";