sales by ad source report: filter by status, #17971
authorMark Wells <mark@freeside.biz>
Fri, 13 Jul 2012 22:33:02 +0000 (15:33 -0700)
committerMark Wells <mark@freeside.biz>
Fri, 13 Jul 2012 22:33:02 +0000 (15:33 -0700)
httemplate/elements/select-cust_pkg-status.html
httemplate/search/cust_bill_pkg_referral.html
httemplate/search/report_cust_bill_pkg_referral.html

index ec37eaf..2114c07 100644 (file)
@@ -3,7 +3,9 @@
         <% $onchange %>
 >
 
+% if ( !$opt{'disable_empty'} ) {
   <OPTION VALUE="">all
+% }
 
 % foreach my $option ( @{ $opt{'statuses'} } ) { 
 
index 1bb6b91..3cb434c 100644 (file)
@@ -135,8 +135,15 @@ my @where = ( $agentnums_sql,
               "cust_bill._date <= $ending",
             );
 
-if ( $cgi->param('status') =~ /^([a-z]+)$/ ) {
-  push @where, FS::cust_pkg->cust_status_sql . " = '$1'";
+my @status_where;
+foreach my $status ($cgi->param('status')) {
+  if ( $status =~ /^([- a-z]+)$/ ) { #"one-time charge"
+    push @status_where, "'$status'";
+  }
+}
+if ( @status_where ) {
+  push @where, '('. FS::cust_pkg->status_sql.
+    ') IN (' . join(',', @status_where) .')';
 }
 
 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
index 1fbb13d..ff2caa1 100644 (file)
   'empty_label'   => 'all',
 &>
 
+<& /elements/tr-select-cust_pkg-status.html,
+  'label'         => 'Package status',
+  'multiple'      => 1,
+  'disable_empty' => 1,
+&>
+
 <& /elements/tr-select-pkg_class.html,
   'pre_options' => [ '' => 'all', '0' => '(empty class)' ],
   'disable_empty' => 1,