This commit was generated by cvs2svn to compensate for changes in r4407,
[freeside.git] / httemplate / elements / select-taxclass.html
1 <%
2   my $conf = new FS::Conf;
3   my $selected_taxclass = scalar(@_) ? shift : '';
4 %>
5
6 <% if ( $conf->exists('enable_taxclasses') ) { %>
7
8     <SELECT NAME="taxclass">
9
10       <% if ( $conf->exists('require_taxclasses') ) { %>
11
12         <OPTION VALUE="(select)">Select tax class
13
14       <% } else { %>
15
16         <OPTION VALUE="">
17
18       <% } %>
19
20       <%
21         my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
22           or die dbh->errstr;
23         $sth->execute or die $sth->errstr;
24         my %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
25         my @taxclasses = grep $_, keys %taxclasses;
26       %>
27   
28       <% foreach my $taxclass ( @taxclasses ) { %>
29   
30           <OPTION VALUE="<%= $taxclass %>"<%= $taxclass eq $selected_taxclass ? ' SELECTED' : '' %>><%= $taxclass %>
31   
32       <% } %>
33
34     </SELECT>
35
36 <% } else { %>
37
38   <INPUT TYPE="hidden" NAME="taxclass" VALUE="<%= $selected_taxclass %>">';
39   
40 <% } %>
41   
42