[freeside-commits] freeside/httemplate/elements select-taxoverride.html, NONE, 1.1 tr-select-taxoverride.html, NONE, 1.1 select-taxproduct.html, 1.4, 1.5 tr-select-taxproduct.html, 1.1, 1.2

Jeff Finucane,420,, jeff at wavetail.420.am
Thu Aug 28 00:38:40 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv24869/httemplate/elements

Modified Files:
	select-taxproduct.html tr-select-taxproduct.html 
Added Files:
	select-taxoverride.html tr-select-taxoverride.html 
Log Message:
multiple usage classes checkpoint

Index: tr-select-taxproduct.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-taxproduct.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tr-select-taxproduct.html	13 Apr 2008 02:56:28 -0000	1.1
+++ tr-select-taxproduct.html	28 Aug 2008 07:38:37 -0000	1.2
@@ -1,22 +1,18 @@
 % if ( $conf->exists('enable_taxproducts') ) { 
-
-    <TR>
-      <TD COLSPAN="2">
-        <% include('select-taxproduct.html', @_) %>
-      </TD>
-    </TR>
+  <%include('tr-td-label.html', @_) %>
+    <TD <% $cell_style %>><% include('select-taxproduct.html', @_) %></TD>
+  </TR>
 
 % } else { 
-
-    <INPUT TYPE="hidden" NAME="taxproductnum" VALUE="<% $opt{taxproductnum} %>">
-    <INPUT TYPE="hidden" NAME="tax_override"  VALUE="<% $opt{tax_override}  %>">
-
+  <INPUT TYPE="hidden" NAME="<% $name %>" VALUE="<% $opt{value} %>">
 % } 
 
 <%init>
 
-my $conf = new FS::Conf; 
+my $conf = new FS::conf;
 
 my %opt = @_;
+my $cell_style = $opt{cell_style} ? 'STYLE="'. $opt{cell_style}. '"' : '';
+my $name = $opt{name} || 'taxproductnum';
 
 </%init>

--- NEW FILE: select-taxoverride.html ---
      <INPUT NAME  = "<% $name %>"
             ID    = "<% $name %>"
             TYPE  = "hidden"
             VALUE = "<% $value %>"
      >
      <A href="javascript:void(0)" onclick="overlib( OLiframeContent('part_pkg_taxoverride.html?element_name=<% $name %>;selected='+document.getElementById('<% $name %>').value, 1100, 600, 'tax_product_popup'), CAPTION, 'Edit <% $class %> product tax overrides', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
        <% $value ? "Edit $class tax overrides" : "Override $class taxes" %>
      </A>
<%init>

my %opt = @_;
my $name = $opt{element_name} || $opt{field} || 'tax_override';
my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};

my %usage_class = map { ($_->classnum => $_->classname) }
                  qsearch('usage_class', {});
$usage_class{setup} = 'Setup';
$usage_class{recur} = 'Recurring';

my $usage;
$name =~ /^tax_override_(\w+)$/ && ( $usage = $1 );

my $class = lc($usage_class{$usage} || "Usage class $usage")
  if $usage;

</%init>

Index: select-taxproduct.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-taxproduct.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- select-taxproduct.html	27 Apr 2008 16:28:42 -0000	1.4
+++ select-taxproduct.html	28 Aug 2008 07:38:37 -0000	1.5
@@ -1,28 +1,26 @@
-<% ntable("#cccccc", 2) %>
-  <TR>
-    <TD align="right">Tax product</TD>
-    <TD>
-      <INPUT name="taxproductnum" id="taxproductnum" type="hidden" value="<% $opt{'taxproductnum'}%>">
-      <INPUT name="taxproductnum_description" id="taxproductnum_description" type="text" value="<% $opt{taxproduct_description} %>" size="12" onclick="overlib( OLiframeContent('<% $p %>/browse/part_pkg_taxproduct.cgi?_type=select&id=taxproductnum&taxproductnum='+document.getElementById('taxproductnum').value, 1000, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
-    </TD>
-  </TR>
-  <TR>
-    <TD colspan="2" align="right">
-      <INPUT name="tax_override" id="tax_override" type="hidden" value="<% $opt{tax_override} %>">
-      <A href="javascript:void(0)" onclick="overlib( OLiframeContent('part_pkg_taxoverride.html?selected='+document.getElementById('tax_override').value, 1100, 600, 'tax_product_popup'), CAPTION, 'Edit product tax overrides', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
-        <% $opt{tax_override} ? 'Edit tax overrides' : 'Override taxes' %>
-      </A>
-    </TD>
-  </TR>
-</TABLE>
-
+<% $opt{'prefix'} %><INPUT NAME    = "<% $name %>"
+                           ID      = "<% $name %>"
+                           TYPE    = "hidden"
+                           VALUE   = "<% $value |h %>"
+                    >
+                    <INPUT NAME    = "<% $name %>_description"
+                           ID      = "<% $name %>_description"
+                           TYPE    = "text"
+                           VALUE   = "<% $description %>"
+                           SIZE    = "12"
+                           onclick = "overlib( OLiframeContent('<% $p %>/browse/part_pkg_taxproduct.cgi?_type=select&id=<% $name %>&taxproductnum='+document.getElementById('<% $name %>').value, 1000, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;"><% $opt{'postfix'} %>
 <%init>
 
 my %opt = @_;
-
-$opt{'taxproductnum'} ||= $opt{'object'}->taxproductnum
-  if $opt{'object'};
-$opt{'taxproduct_description'} ||= $opt{'object'}->taxproduct_description
-  if $opt{'object'};
+my $name = $opt{element_name} || $opt{field} || 'taxproductnum';
+my $value = length($opt{curr_value}) ? $opt{curr_value} : $opt{value};
+my $description = $opt{'taxproduct_description'};
+  
+unless ( $description || ! $value ) {
+    my $part_pkg_taxproduct =
+      qsearchs( 'part_pkg_taxproduct', { 'taxproductnum'=> $value } );
+    $description = $part_pkg_taxproduct->description
+      if $part_pkg_taxproduct;
+}
 
 </%init>

--- NEW FILE: tr-select-taxoverride.html ---
% if ( $conf->exists('enable_taxproducts') ) { 
  <%include('tr-td-label.html', @_) %>
    <TD <% $cell_style %>><% include('select-taxoverride.html', @_) %></TD>
  </TR>

% } else { 
  <INPUT TYPE="hidden" NAME="<% $name %>" VALUE="<% $opt{value} %>">
% } 

<%init>

my $conf = new FS::conf;

my %opt = @_;
my $cell_style = $opt{'cell_style'}? 'STYLE="'. $opt{cell_style}. '"' : '';
my $name = $opt{name} || 'tax_override';

</%init>



More information about the freeside-commits mailing list