Merge branch 'master' of https://github.com/jgoodman/Freeside
[freeside.git] / httemplate / search / customer_accounting_summary.html
index 12c8962..c9cfa40 100644 (file)
@@ -121,10 +121,7 @@ die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
 
 my ($agentnum,$sel_agent);
-if ( $cgi->param('agentnum') eq 'all' ) {
-  $agentnum = 0;
-}
-elsif ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
   $agentnum = $1;
   $sel_agent = qsearchs('agent', { 'agentnum' => $agentnum } );
   die "agentnum $agentnum not found!" unless $sel_agent;
@@ -142,8 +139,6 @@ $title .=  $sel_part_referral->referral.' '
 
 $title .= 'Customer Accounting Summary Report';
 
-my @cust_classnums = grep /^\d+$/, $cgi->param('cust_classnum');
-
 my @items  = ('netsales', 'cashflow');
 my @params = ( [], [] );
 my $setuprecur = '';
@@ -173,16 +168,12 @@ foreach (qw(agentnum refnum status)) {
   }
 }
 $search_hash{'classnum'} = [ $cgi->param('cust_classnum') ] 
-  if $cgi->param('cust_classnum');
+  if grep { $_ eq 'cust_classnum' } $cgi->param;
 
 my $query = FS::cust_main::Search->search(\%search_hash);
 my @custs = qsearch($query);
 
 foreach my $cust_main ( @custs ) {
-  # XXX should do this in the qsearch
-  next unless ($status eq '' || $status eq $cust_main->status); 
-  next unless ($agentnum == 0 || $cust_main->agentnum eq $agentnum);
-  next unless ($refnum   == 0 || $cust_main->refnum eq $refnum);
 
   push @custnames, $cust_main->name;