'discountnum' => { 'label' => 'Discount',
'type' => 'select-table', #we don't handle the select-discount create a discount case
'table' => 'discount',
- 'name_col' => 'description', #well, method
- 'order_by' => 'ORDER BY discountnum', #requied because name_col is a method
+ #(well, since 2013 it winds up calling select-discount
+ # anyway (but not tr-select-discount)
+ #'name_col' => 'description', #well, method
+ #'order_by' => 'ORDER BY discountnum', #requied because name_col is a method
+ 'disable_empty' => 1,
'hashref' => { 'disabled' => '',
'months' => { op=>'!=', value=>'0' },
},
- 'disable_empty' => 1,
+ 'disable_custom_discount' => 1,
},
);
}
'order_by' => 'ORDER BY discountnum', #XXX weight
'value' => $discountnum,
'empty_label' => '(none)',
- 'hashref' => { 'disabled' => '' },
+ 'hashref' => $hashref,
'post_options' => $post_options,
%opt,
)
my $curuser = $FS::CurrentUser::CurrentUser;
-#make an opt if we need to turn this off
-my $post_options = $curuser->access_right('Custom discount customer package')
- ? [ -1 => 'Custom discount' ]
- : [];
+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>