X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Felements%2Fselect-taxclass.html;h=3c1558b72db8c0ba5b171273f0a5167a4754e078;hb=0930d22ffc440f80c1b222b2e750cadbabd9e8f6;hp=495572323944625f17a7a9ba3de768d403183b43;hpb=c8cccb4a92adceb943c635fe62dad0d034462ce0;p=freeside.git
diff --git a/httemplate/elements/select-taxclass.html b/httemplate/elements/select-taxclass.html
index 495572323..3c1558b72 100644
--- a/httemplate/elements/select-taxclass.html
+++ b/httemplate/elements/select-taxclass.html
@@ -1,40 +1,38 @@
-%
-% my $conf = new FS::Conf;
-% my $selected_taxclass = scalar(@_) ? shift : '';
-%
% 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>