summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-discount.html
blob: 3a267ed08dbd08a7516e4689f7aa7edc74ab6d5e (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
29
30
<% include( '/elements/select-table.html',
                 'table'        => 'discount',
                 'name_col'     => 'description',
                 'order_by'     => 'ORDER BY discountnum', #XXX weight
                 'value'        => $discountnum,
                 'empty_label'  => '(none)',
                 'hashref'      => $hashref,
                 '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;

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>