%doc>
In order_pkg.html or similar:
<& /elements/tr-select-pkg-discount.html,
curr_value_setup => ($cgi->param('setup_discountnum') || ''),
curr_value_recur => ($cgi->param('recur_discountnum') || ''),
disable_setup => 0,
disable_recur => 0,
disable_waive_setup => 0,
carry_value_setup => $carry_setup_discountnum,
carry_value_recur => $carry_recur_discountnum,
&>
This provides the following:
- If the user can waive setup fees or apply a discount, they get a
select box for the setup discount, with "Waive setup fee" as an option.
- If they can custom discount, they will also get "Custom discount" as an
option. If selected, this will show fields to enter the custom discount
amount/percentage.
- If they can waive setup fees but NOT apply a discount, they only get a
checkbox to waive setup fee.
- Same for recurring fee, but without the "waive setup fee" stuff, obviously.
- Custom recurring discounts also have an option for a duration in months.
- When changing a package, the original package's discount option is
labeled in the select options
"disable_setup" locks the setup discount, but will still show a static
description if curr_value_setup is set. Likewise "disable_recur".
%doc>
% # SETUP DISCOUNT
% # select-discount knows about the "custom discount" ACL
% if ( $curuser->access_right('Discount customer package')
% and !$opt{disable_setup} )
% {
% my $pre_options = [ '' => '(none)' ];
% push @$pre_options, -2 => 'Waive setup fee'
% if $curuser->access_right('Waive setup fee')
% && ! $opt{'disable_waive_setup'};
<& tr-td-label.html, label => $opt{setup_label} || emt('Setup fee') &>