X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_credit_bill_pkg.html;h=b5a0ee9f60e3eaf070d22bba1e2194ad71cd4dca;hb=01698260f2624212ab71be26bb4c644c0aeea2e4;hp=b0dbc7000b77715907a016297d3be7bb2ab83608;hpb=c13c6407510f6fd1783ce0fbd97800afa27c30b5;p=freeside.git diff --git a/httemplate/search/cust_credit_bill_pkg.html b/httemplate/search/cust_credit_bill_pkg.html index b0dbc7000..b5a0ee9f6 100644 --- a/httemplate/search/cust_credit_bill_pkg.html +++ b/httemplate/search/cust_credit_bill_pkg.html @@ -203,6 +203,7 @@ if ( $cgi->param('taxclass') my @loc_param = qw( district city county state country ); if ( $cgi->param('out') ) { + # probably don't need this part my ( $loc_sql, @param ) = FS::cust_pkg->location_sql( 'ornull' => 1 ); while ( $loc_sql =~ /\?/ ) { #easier to do our own substitution @@ -242,6 +243,8 @@ if ( $cgi->param('out') ) { #hacky, could be more efficient. care if it is ever used for more than the # tax-report_groups filtering kludge + # (does that even still exist? if so, correct this (or location_sql itself) + # to work with modern cust_location links) my $locs_sql = ' ( '. join(' OR ', map { @@ -266,15 +269,24 @@ if ( $cgi->param('out') ) { } else { - my %ph = map { $_ => dbh->quote( scalar($cgi->param($_)) ) } @loc_param; - - 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; + my @loc_where; + foreach (@loc_param) { + if ( length($cgi->param($_)) ) { + my $quoted = dbh->quote($cgi->param($_)); + push @loc_where, "(COALESCE(cust_location.$_, '') = $quoted)"; + } } + my $loc_sql = join(' AND ', @loc_where); - push @where, $loc_sql; + #my %ph = map { $_ => dbh->quote( scalar($cgi->param($_)) ) } @loc_param; + # + #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; +warn $loc_sql; } my($title, $name); @@ -429,7 +441,7 @@ if ( $cgi->param('nottax') ) { s/cust_pkg\.locationnum/cust_bill_pkg_tax_location.locationnum/g for @where; } -} else { +} else { #warn "neither nottax nor istax parameters specified"; #same as before? @@ -464,7 +476,7 @@ my @post_desc_header = (); my @post_desc = (); my @post_desc_null = (); my $post_desc_align = ''; -if ( $conf->exists('enable_taxclasses') ) { +if ( $conf->exists('enable_taxclasses') && ! $cgi->param('istax') ) { push @post_desc_header, 'Tax class'; push @post_desc, 'taxclass'; push @post_desc_null, '';