X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-taxclass.html;h=6845d23605c2c6631ed54f1d97e4ad0150b7d048;hb=62b18c75989a1b00a25079f8f110992aaad81bba;hp=e5a1abba1b10dfc3cd7b9ece930d7c2a2189c8a4;hpb=51ee6aade4795bf31954e4a5e6aff685a8c31b8b;p=freeside.git
diff --git a/httemplate/elements/select-taxclass.html b/httemplate/elements/select-taxclass.html
index e5a1abba1..6845d2360 100644
--- a/httemplate/elements/select-taxclass.html
+++ b/httemplate/elements/select-taxclass.html
@@ -1,42 +1,41 @@
-<%
- my $conf = new FS::Conf;
- my $selected_taxclass = scalar(@_) ? shift : '';
-%>
+% if ( $conf->exists('enable_taxclasses') ) {
-<% if ( $conf->exists('enable_taxclasses') ) { %>
+
+<%init>
+
+my %opt = @_;
+my $selected_taxclass = $opt{'curr_value'}; # || $opt{'value'} necessary?
+
+my $conf = new FS::Conf;
+
+unless ( $opt{'taxclasses'} ) {
-<% } else { %>
+ #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;
-
-
-<% } %>
-
+}
+%init>