summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorivan <ivan>2005-10-08 00:47:20 +0000
committerivan <ivan>2005-10-08 00:47:20 +0000
commitd1a885c65ac10e19bed0333a380dafeb42c2cef1 (patch)
tree40656923923b75a13114955c182c899c14a85ac8 /httemplate/elements
parent4d77eb68f3501500ae66f84626b3922e2bb52e40 (diff)
fix tax class selection in package add/edit too
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/select-taxclass.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/httemplate/elements/select-taxclass.html b/httemplate/elements/select-taxclass.html
new file mode 100644
index 000000000..e8889d59d
--- /dev/null
+++ b/httemplate/elements/select-taxclass.html
@@ -0,0 +1,42 @@
+<%
+ my $conf = new FS::Conf;
+ my $selected_taxclass = scalar(@_) ? shift : '';
+%>
+
+<% if ( $conf->exists('enable_taxclasses') ) { %>
+
+ <SELECT NAME="taxclass">
+
+ <% if ( $conf->exists('require_taxclasses') ) { %>
+
+ <OPTION VALUE="(select)">Select tax class
+
+ <% } else { %>
+
+ <OPTION VALUE="">
+
+ <% } %>
+
+ <%
+ 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};
+ my @taxclasses = grep $_, keys %taxclasses;
+ %>
+
+ <% foreach my $taxclass ( @taxclasses ) { %>
+
+ <OPTION VALUE="<%= $taxclass %>"<%= $taxclass eq $selected_taxclass ? ' SELECTED' : '' %>><%= $taxclass %>
+
+ <% } %>
+
+ </SELECT>
+
+<% } else { %>
+
+ <INPUT TYPE="hidden" NAME="taxclass" VALUE="<%= $selected_taxclass %>">';
+
+<% } %>
+
+