X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill_pkg_referral.html;h=1289ff7ee0f487b65f2164e1c971c23c6c7882df;hb=e55892bdf6dc95710a19876087690a9664421215;hp=f17cea3d9eee64cd829357bec3a5d016e193691e;hpb=0610c50fd0786e2e6ccc850d68b6e865eba86541;p=freeside.git diff --git a/httemplate/search/cust_bill_pkg_referral.html b/httemplate/search/cust_bill_pkg_referral.html index f17cea3d9..1289ff7ee 100644 --- a/httemplate/search/cust_bill_pkg_referral.html +++ b/httemplate/search/cust_bill_pkg_referral.html @@ -135,8 +135,30 @@ 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) .')'; +} + +my @refnum; +foreach my $refnum ($cgi->param('refnum')) { + if ( $refnum =~ /^\d+$/ ) { + push @refnum, $refnum; + } +} +if ( @refnum ) { + push @where, 'cust_main.refnum IN ('.join(',', @refnum).')'; +} + +my @cust_classnums = grep /^\d+$/, $cgi->param('cust_classnum'); +if ( @cust_classnums ) { + push @where, 'cust_main.classnum IN ('.join(',', @cust_classnums).')'; } if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { @@ -190,7 +212,7 @@ my @orwhere; push @orwhere, "(cust_bill_pkg.setup > 0)" if $setup; push @orwhere, "($recur_sql > 0)" if $recur; push @orwhere, "($usage_sql > 0)" if $usage; -push @where, join(' OR ', @orwhere); +push @where, '('.join(' OR ', @orwhere).')' if @orwhere; $join_cust = ' JOIN cust_bill USING ( invnum ) LEFT JOIN cust_main USING ( custnum )