From aeae062630d148cad199305dd601ce33e37714f1 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 27 May 2009 22:13:59 +0000 Subject: [PATCH] maybe this willf inally fix total line links on tax report when using report_group kludge? (still possibly not in all corner cases), RT#5446 --- httemplate/search/cust_bill_pkg.cgi | 2 +- httemplate/search/report_tax.cgi | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index f644dcfd4..b150989ce 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -168,7 +168,7 @@ if ( $cgi->param('out') ) { my %ph = ( 'county' => $_, map { $_ => dbh->quote( $cgi->param($_) ) } - qw( county state country ) + qw( state country ) ); my ( $loc_sql, @param ) = FS::cust_pkg->location_sql; diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi index ed5ebef03..1a94163b4 100755 --- a/httemplate/search/report_tax.cgi +++ b/httemplate/search/report_tax.cgi @@ -285,6 +285,9 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county', my $label = getlabel($r); $regions{$label}->{'label'} = $label; + + $regions{$label}->{$_} = $r->$_() for (qw( county state country )); #taxname? + $regions{$label}->{'url_param'} = join(';', map "$_=".uri_escape($r->$_()), qw( county state country taxname ) @@ -532,6 +535,9 @@ my @regions = keys %regions; my( $total, $tot_taxable, $tot_owed ) = ( 0, 0, 0 ); my( $exempt_cust, $exempt_pkg, $exempt_monthly ) = ( 0, 0, 0 ); my %taxclasses = (); +my %county = (); +my %state = (); +my %country = (); foreach (@regions) { $total += $regions{$_}->{'total'}; $tot_taxable += $regions{$_}->{'taxable'}; @@ -541,13 +547,32 @@ foreach (@regions) { $exempt_monthly += $regions{$_}->{'exempt_monthly'}; $taxclasses{$regions{$_}->{'taxclass'}} = 1 if $regions{$_}->{'taxclass'}; + $county{$regions{$_}->{'county'}} = 1; + $state{$regions{$_}->{'state'}} = 1; + $country{$regions{$_}->{'country'}} = 1; } my $total_url_param = ''; if ( $group_op ) { + + my @country = keys %country; + warn "WARNING: multiple countries on this grouped report; total links broken" + if scalar(@country) > 1; + my $country = $country[0]; + + my @state = keys %state; + warn "WARNING: multiple countries on this grouped report; total links broken" + if scalar(@state) > 1; + my $state = $state[0]; + $total_url_param = 'report_group='.uri_escape("$group_op $group_value").';'. - join(';', map 'taxclass='.dbh->quote($_), keys %taxclasses ); + join(';', map 'taxclass='.uri_escape($_), keys %taxclasses ).';'. + "country=$country;state=".uri_escape($state).';'. + join(';', map 'county='.uri_escape($_), keys %county ) + ; + + } #ordering -- 2.11.0