[freeside-commits] freeside/httemplate/elements tr-select-taxclass.html, NONE, 1.1 select-taxclass.html, 1.3, 1.4

Ivan,,, ivan at wavetail.420.am
Tue Jan 30 20:26:46 PST 2007


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail:/tmp/cvs-serv26186/httemplate/elements

Modified Files:
	select-taxclass.html 
Added Files:
	tr-select-taxclass.html 
Log Message:
minor UI work on one-time charges w/taxclasses

Index: select-taxclass.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-taxclass.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- select-taxclass.html	23 Aug 2006 22:25:38 -0000	1.3
+++ select-taxclass.html	31 Jan 2007 04:26:44 -0000	1.4
@@ -1,40 +1,38 @@
-%
-%  my $conf = new FS::Conf;
-%  my $selected_taxclass = scalar(@_) ? shift : '';
-%
 % if ( $conf->exists('enable_taxclasses') ) { 
 
-
     <SELECT NAME="taxclass">
-% if ( $conf->exists('require_taxclasses') ) { 
-
 
+%   if ( $conf->exists('require_taxclasses') ) { 
         <OPTION VALUE="(select)">Select tax class
-% } else { 
-
-
+%   } 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 %>
-% } 
+%   } 
 
+%   foreach my $taxclass ( @{ $opt{'taxclasses'} } ) { 
+        <OPTION VALUE="<% $taxclass %>"<% $taxclass eq $selected_taxclass ? ' SELECTED' : '' %>><% $taxclass %>
+%   } 
 
     </SELECT>
-% } else { 
 
+% } else { 
 
   <INPUT TYPE="hidden" NAME="taxclass" VALUE="<% $selected_taxclass %>">
+
 % } 
 
-  
+<%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>

--- NEW FILE: tr-select-taxclass.html ---
% if ( ! $conf->exists('enable_taxclasses')
%      || scalar(@{ $opt{'taxclasses'} }) == 0
% ) { 

  <INPUT TYPE="hidden" NAME="taxclass" VALUE="<% $taxclass %>">

% } else { 

  <TR>
    <TD ALIGN="right"><% $opt{'label'} || 'Tax class: ' %></TD>
    <TD>
      <% include( '/elements/select-taxclass.html', $taxclass, %opt ) %>
    </TD>
  </TR>

% } 
<%init>

my( $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>



More information about the freeside-commits mailing list