summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
authorivan <ivan>2009-05-27 22:10:41 +0000
committerivan <ivan>2009-05-27 22:10:41 +0000
commit332cff350f042ba6f4aa6ca42043d03eb18105fb (patch)
treee26ece530144c6c700a6550e19d94324e88e9e97 /httemplate/search
parent1ea01e0de07329bb1dfdf4e984b6ef3ad6561d84 (diff)
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
Diffstat (limited to 'httemplate/search')
-rw-r--r--httemplate/search/cust_bill_pkg.cgi46
1 files changed, 39 insertions, 7 deletions
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') ) {