From: ivan Date: Wed, 27 May 2009 22:10:41 +0000 (+0000) Subject: maybe this willf inally fix total line links on tax report when using report_group... X-Git-Tag: freeside_1_9_1^2~393 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=332cff350f042ba6f4aa6ca42043d03eb18105fb;p=freeside.git 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 --- diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 61f3f3f87..f644dcfd4 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -156,15 +156,47 @@ if ( $cgi->param('out') ) { } elsif ( $cgi->param('country') ) { - my %ph = map { $_ => dbh->quote( $cgi->param($_) ) } - qw( county state country ); + my @counties = $cgi->param('county'); + + if ( scalar(@counties) > 1 ) { - my ( $loc_sql, @param ) = FS::cust_pkg->location_sql; - while ( $loc_sql =~ /\?/ ) { #easier to do our own substitution - $loc_sql =~ s/\?/$ph{shift(@param)}/e; - } + #hacky, could be more efficient. care if it is ever used for more than the + # tax-report_groups filtering kludge + + my $locs_sql = + ' ( '. join(' OR ', map { + + my %ph = ( 'county' => $_, + map { $_ => dbh->quote( $cgi->param($_) ) } + qw( county state country ) + ); + + my ( $loc_sql, @param ) = FS::cust_pkg->location_sql; + while ( $loc_sql =~ /\?/ ) { #easier to do our own substitution + $loc_sql =~ s/\?/$ph{shift(@param)}/e; + } + + $loc_sql; + + } @counties + + ). ' ) '; + + push @where, $locs_sql; + + } else { - push @where, $loc_sql; + my %ph = map { $_ => dbh->quote( $cgi->param($_) ) } + qw( county state country ); + + my ( $loc_sql, @param ) = FS::cust_pkg->location_sql; + while ( $loc_sql =~ /\?/ ) { #easier to do our own substitution + $loc_sql =~ s/\?/$ph{shift(@param)}/e; + } + + push @where, $loc_sql; + + } if ( $cgi->param('istax') ) { if ( $cgi->param('taxname') ) {