X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-taxclass.html;h=6fe35d32cd25b352945789036480309459ec3a59;hb=12c2362c84bea9f2e03ed9c67b2de8d453202ebf;hp=e8889d59d8fa808801734996be9a50fa007e1288;hpb=d1a885c65ac10e19bed0333a380dafeb42c2cef1;p=freeside.git
diff --git a/httemplate/elements/select-taxclass.html b/httemplate/elements/select-taxclass.html
index e8889d59d..6fe35d32c 100644
--- a/httemplate/elements/select-taxclass.html
+++ b/httemplate/elements/select-taxclass.html
@@ -1,42 +1,38 @@
-<%
- my $conf = new FS::Conf;
- my $selected_taxclass = scalar(@_) ? shift : '';
-%>
+% if ( $conf->exists('enable_taxclasses') ) {
-<% if ( $conf->exists('enable_taxclasses') ) { %>
+
+<%init>
+
+my( $selected_taxclass, %opt ) = @_;
+my $conf = new FS::Conf;
+
+unless ( $opt{'taxclasses'} ) {
-<% } else { %>
+ my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
+ or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+ my %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
+ @{ $opt{'taxclasses'} } = grep $_, keys %taxclasses;
- ';
-
-<% } %>
-
+}
+%init>