From 796183f5d59290f1d8b678f4a5d86431389eb5df Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 21 Jul 2011 23:33:11 +0000 Subject: [PATCH] fix tax reports for taxclass+non-taxclass cases, RT#13160 --- httemplate/search/cust_bill_pkg.cgi | 11 +++++------ httemplate/search/report_tax.cgi | 7 ++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 007f59399..15edba0b7 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -73,6 +73,7 @@ \&FS::UI::Web::cust_fields, ], 'sort_fields' => [ + '', 'setup', #broken in $unearned case i guess ( $unearned ? ('', '') : () ), ( $use_usage eq 'recurring' ? 'recur - usage' : @@ -201,12 +202,9 @@ if ( $cgi->param('taxclass') # #} else { - push @where, - ' ( '. join(' OR ', - map ' part_pkg.taxclass = '.dbh->quote($_), - $cgi->param('taxclass') - ). - ' ) '; + push @where, ' part_pkg.taxclass IN ( '. + join(', ', map dbh->quote($_), $cgi->param('taxclass') ). + ' ) '; #} @@ -312,6 +310,7 @@ if ( $cgi->param('out') ) { die "unknown base region for empty taxclass" unless $cust_main_county; my $same_sql = $cust_main_county->sql_taxclass_sameregion; + $same_sql =~ s/taxclass/part_pkg.taxclass/g; push @where, $same_sql if $same_sql; } diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi index 93e5b51c9..0cd652d83 100755 --- a/httemplate/search/report_tax.cgi +++ b/httemplate/search/report_tax.cgi @@ -366,12 +366,13 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county', } else { - $regions{$label}->{'url_param'} .= ';taxclassNULL=1' - if $cgi->param('show_taxclasses'); - my $same_sql = $r->sql_taxclass_sameregion; $mywhere .= " AND $same_sql" if $same_sql; + $regions{$label}->{'url_param'} .= ';taxclassNULL=1' + if $cgi->param('show_taxclasses') + || $same_sql; + } my $fromwhere = "$from_join_cust_pkg $mywhere"; # AND payby != 'COMP' "; -- 2.11.0