diff options
author | jeff <jeff> | 2008-08-28 07:38:40 +0000 |
---|---|---|
committer | jeff <jeff> | 2008-08-28 07:38:40 +0000 |
commit | 669bd6b315633c99ac61441198c2c4e45401c36b (patch) | |
tree | af72b9ad7bf116b147700f63f5b2895b0c9c9e5b /httemplate/elements | |
parent | 2c37cd91ea7951b70ea5d420e989128d78ce0a80 (diff) |
multiple usage classes checkpoint
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/select-taxoverride.html | 26 | ||||
-rw-r--r-- | httemplate/elements/select-taxproduct.html | 44 | ||||
-rw-r--r-- | httemplate/elements/tr-select-taxoverride.html | 18 | ||||
-rw-r--r-- | httemplate/elements/tr-select-taxproduct.html | 18 |
4 files changed, 72 insertions, 34 deletions
diff --git a/httemplate/elements/select-taxoverride.html b/httemplate/elements/select-taxoverride.html new file mode 100644 index 000000000..f3bfb5fd7 --- /dev/null +++ b/httemplate/elements/select-taxoverride.html @@ -0,0 +1,26 @@ + <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> diff --git a/httemplate/elements/select-taxproduct.html b/httemplate/elements/select-taxproduct.html index 74044b108..37a428960 100644 --- a/httemplate/elements/select-taxproduct.html +++ b/httemplate/elements/select-taxproduct.html @@ -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> diff --git a/httemplate/elements/tr-select-taxoverride.html b/httemplate/elements/tr-select-taxoverride.html new file mode 100644 index 000000000..4954a5566 --- /dev/null +++ b/httemplate/elements/tr-select-taxoverride.html @@ -0,0 +1,18 @@ +% 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> diff --git a/httemplate/elements/tr-select-taxproduct.html b/httemplate/elements/tr-select-taxproduct.html index f9f192a28..951222475 100644 --- a/httemplate/elements/tr-select-taxproduct.html +++ b/httemplate/elements/tr-select-taxproduct.html @@ -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> |