X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-discount.html;h=ee862519f7705b7505c8b988c51d0e3723fe8b77;hp=df221da9623813fb949b3f3e83324d8d643269b3;hb=f822e27a1e00594332ffa487a1c284234c5580a6;hpb=4cacb3fa439b56fc7c9a742b69ec3f6ffd660433 diff --git a/httemplate/elements/tr-select-discount.html b/httemplate/elements/tr-select-discount.html index df221da96..ee862519f 100644 --- a/httemplate/elements/tr-select-discount.html +++ b/httemplate/elements/tr-select-discount.html @@ -6,11 +6,11 @@ % } else { - <% $opt{'label'} || 'Discount' %> + <% $opt{'label'} || ''.emt('Discount').'' %> > <% include( '/elements/select-discount.html', 'curr_value' => $discountnum, - 'onchange' => $name.'_changed', + 'onchange' => $onchange, %opt, ) %> @@ -19,7 +19,7 @@ % # a weird kind of false laziness w/edit/discount.html - +% # <% include( '/elements/tr-select.html', @@ -27,18 +27,18 @@ 'field' => $name. '__type', 'id' => $name. '__type', 'options' => \@_type_options, - #XXX 'curr_value' => - 'onchange' => '_type_changed', + 'curr_value' => scalar($cgi->param($name.'__type')), + 'onchange' => $name.'__type_changed', 'colspan' => $opt{'colspan'}, ) %> <% include( '/elements/tr-input-money.html', - 'label' => 'Discount Amount', + 'label' => 'Discount Amount ', 'field' => $name. '_amount', 'id' => $name. '_amount', 'default' => '0.00', - #XXX 'curr_value' => + 'curr_value' => scalar($cgi->param($name.'_amount')), 'colspan' => $opt{'colspan'}, ) %> @@ -48,22 +48,42 @@ 'field' => $name. '_percent', 'id' => $name. '_percent', 'default' => '0', - #XXX 'curr_value' => + 'curr_value' => scalar($cgi->param($name.'_percent')), 'colspan' => $opt{'colspan'}, ) %> <% include( '/elements/tr-input-text.html', - 'label' => 'Discount # of Months', + 'label' => 'Discount duration (months)', 'field' => $name. '_months', 'id' => $name. '_months', 'size' => 2, 'postfix' => qq((blank for non-expiring discount)), - #XXX 'curr_value' => + 'curr_value' => scalar($cgi->param($name.'_months')), 'colspan' => $opt{'colspan'}, ) %> + <% include( '/elements/tr-checkbox.html', + 'label' => 'Apply discount to setup fee', + 'field' => $name.'_setup', + 'id' => $name.'_setup', + 'curr_value' => scalar($cgi->param($name.'_setup')), + 'value' => 'Y', + 'colspan' => $opt{'colspan'}, + ) + %> + +%# <% include( '/elements/tr-checkbox.html', +%# 'label' => 'Apply discount to add-on packages', +%# 'field' => $name.'_linked', +%# 'id' => $name.'_linked', +%# 'curr_value' => scalar($cgi->param($name.'_linked')), +%# 'value' => 'Y', +%# 'colspan' => $opt{'colspan'}, +%# ) +%# %> + % } <%init> my %opt = @_; +my $cgi = $opt{'cgi'}; my $discountnum = $opt{'curr_value'} || $opt{'value'}; $opt{'discount'} ||= [ qsearch( 'discount', { disabled=>'' } ) ]; @@ -170,4 +206,7 @@ unshift @_type_options, $select; my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : ''; +my $onchange = ( $opt{'onchange'} ? delete($opt{'onchange'}).';' : '' ). + $name.'_changed(this);'; +