minor UI work on one-time charges w/taxclasses
[freeside.git] / httemplate / elements / tr-select-taxclass.html
1 % if ( ! $conf->exists('enable_taxclasses')
2 %      || scalar(@{ $opt{'taxclasses'} }) == 0
3 % ) { 
4
5   <INPUT TYPE="hidden" NAME="taxclass" VALUE="<% $taxclass %>">
6
7 % } else { 
8
9   <TR>
10     <TD ALIGN="right"><% $opt{'label'} || 'Tax class: ' %></TD>
11     <TD>
12       <% include( '/elements/select-taxclass.html', $taxclass, %opt ) %>
13     </TD>
14   </TR>
15
16 % } 
17 <%init>
18
19 my( $taxclass, %opt ) = @_;
20 my $conf = new FS::Conf;
21
22 unless ( $opt{'taxclasses'} ) {
23
24   my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
25      or die dbh->errstr;
26   $sth->execute or die $sth->errstr;
27   my %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
28   @{ $opt{'taxclasses'} } = grep $_, keys %taxclasses;
29
30 }
31
32 </%init>