X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_credit.html;h=d1f41df00ca8fb71e9254bdbe2b09016ee469d93;hb=e55892bdf6dc95710a19876087690a9664421215;hp=38f03491d6c4b60fb97422d816a80bb53a01bcfb;hpb=a6fe07e49e3fc12169e801b1ed6874c3a5bd8500;p=freeside.git diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html index 38f03491d..d1f41df00 100755 --- a/httemplate/search/cust_credit.html +++ b/httemplate/search/cust_credit.html @@ -103,6 +103,12 @@ if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) { $title = $part_referral->referral. " $title"; } +if ( $cgi->param('cust_classnum') ) { + my @classnums = grep /^\d+$/, $cgi->param('cust_classnum'); + push @search, 'cust_main.classnum IN('.join(',',@classnums).')' + if @classnums; +} + if ( $unapplied ) { push @search, FS::cust_credit->unapplied_sql . ' > 0'; } @@ -131,7 +137,7 @@ my $where = 'WHERE '. join(' AND ', @search); my $count_query = 'SELECT COUNT(*), SUM(amount) '; $count_query .= ', SUM(' . FS::cust_credit->unapplied_sql . ') ' if $unapplied; -$count_query .= 'FROM cust_credit LEFT JOIN cust_main USING ( custnum ) '. +$count_query .= 'FROM cust_credit'. FS::UI::Web::join_cust_main('cust_credit'). $where; my @count_addl = ( $money_char.'%.2f total credited (gross)' ); @@ -142,7 +148,7 @@ my $sql_query = { 'select' => join(', ',@select), 'hashref' => {}, 'extra_sql' => $where, - 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'addl_from' => FS::UI::Web::join_cust_main('cust_credit') };