summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-discount.html
blob: b7f1fa5bea89572f06dff24843161d10d770b8fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<% include( '/elements/select-table.html',
                 'table'        => 'discount',
                 'name_col'     => 'description',
                 'order_by'     => 'ORDER BY discountnum', #XXX weight
                 'value'        => $discountnum,
                 'empty_label'  => '(none)',
                 'hashref'      => { 'disabled' => '' },
                 'post_options' => $post_options,
                 %opt,
             )
%>
<%init>

my %opt = @_;
my $discountnum = $opt{'curr_value'} || $opt{'value'};

$opt{'records'} = delete $opt{'discount'}
  if $opt{'discount'};

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' ]
  : [];

</%init>