X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-taxclass.html;h=3c1558b72db8c0ba5b171273f0a5167a4754e078;hb=3fc09b0e69ba395c452b636696c3576c9a762af6;hp=e8889d59d8fa808801734996be9a50fa007e1288;hpb=d1a885c65ac10e19bed0333a380dafeb42c2cef1;p=freeside.git
diff --git a/httemplate/elements/select-taxclass.html b/httemplate/elements/select-taxclass.html
index e8889d59d..3c1558b72 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') ) {
-<% } else { %>
+% } else {
+
+
+
+% }
+
+<%init>
+
+my( $selected_taxclass, %opt ) = @_;
+my $conf = new FS::Conf;
+
+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 %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
+ @{ $opt{'taxclasses'} } = grep $_, keys %taxclasses;
- ';
-
-<% } %>
-
+}
+%init>