X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-taxclass.html;h=22c560ea77896d56e8c352dcf297c1a269430c20;hp=424d5ad02b7f593bce882200aff548a15df2625d;hb=24a7dd6d18a1413ec34b906274365e4b2fef28e8;hpb=89cb729e71c400307f47eef8e9e0b295db2dfca0 diff --git a/httemplate/elements/tr-select-taxclass.html b/httemplate/elements/tr-select-taxclass.html index 424d5ad02..22c560ea7 100644 --- a/httemplate/elements/tr-select-taxclass.html +++ b/httemplate/elements/tr-select-taxclass.html @@ -2,28 +2,34 @@ % || scalar(@{ $opt{'taxclasses'} }) == 0 % ) { - + % } else { - <% $opt{'label'} || 'Tax class: ' %> + <% $opt{'label'} || 'Tax class: ' %> - <% include( '/elements/select-taxclass.html', $taxclass, %opt ) %> + <% include( '/elements/select-taxclass.html', + 'curr_value' => $selected_taxclass, + %opt + ) + %> % } <%init> -my( $taxclass, %opt ) = @_; +my( %opt ) = @_; my $conf = new FS::Conf; +my $selected_taxclass = $opt{'curr_value'}; # || $opt{'value'} necessary? unless ( $opt{'taxclasses'} ) { - my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county') - or die dbh->errstr; - $sth->execute or die $sth->errstr; + #my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county') + my $sth = dbh->prepare("SELECT taxclass FROM part_pkg_taxclass WHERE disabled IS NULL OR disabled = '' OR taxclass = ?") + or die dbh->errstr; + $sth->execute($selected_taxclass) or die $sth->errstr; my %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref}; @{ $opt{'taxclasses'} } = grep $_, keys %taxclasses;