<% include( '/elements/select-table.html',
- 'table' => 'discount',
- 'name_col' => 'description',
- 'order_by' => 'ORDER BY discountnum', #XXX weight
- 'value' => $discountnum,
- 'empty_label' => '(none)',
- 'hashref' => { 'disabled' => '' },
+ 'table' => 'discount',
+ 'name_col' => 'description',
+ 'order_by' => 'ORDER BY discountnum', #XXX weight
+ 'value' => $discountnum,
+ 'empty_label' => '(none)',
+ 'hashref' => $hashref,
+ 'post_options' => $post_options,
%opt,
)
%>
$opt{'records'} = delete $opt{'discount'}
if $opt{'discount'};
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+my $hashref = $opt{hashref} || { 'disabled' => '' };
+
+my $post_options = [];
+push @$post_options, -1 => 'Custom discount'
+ if $curuser->access_right('Custom discount customer package')
+ && ! $opt{disable_custom_discount};
+
</%init>