X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-discount.html;h=6bfc48530add619901dbca3337e61b9f9da5c263;hb=197e19d52c02f541850ca06f2628d86c2c3b9464;hp=df221da9623813fb949b3f3e83324d8d643269b3;hpb=4cacb3fa439b56fc7c9a742b69ec3f6ffd660433;p=freeside.git
diff --git a/httemplate/elements/tr-select-discount.html b/httemplate/elements/tr-select-discount.html
index df221da96..6bfc48530 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,32 @@
'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'},
+ )
+ %>
+
% }
<%init>
my %opt = @_;
+my $cgi = $opt{'cgi'};
my $discountnum = $opt{'curr_value'} || $opt{'value'};
$opt{'discount'} ||= [ qsearch( 'discount', { disabled=>'' } ) ];
@@ -170,4 +192,7 @@ unshift @_type_options, $select;
my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';
+my $onchange = ( $opt{'onchange'} ? delete($opt{'onchange'}).';' : '' ).
+ $name.'_changed(this);';
+
%init>
|