default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / httemplate / elements / select-discount.html
1 <% include( '/elements/select-table.html',
2                  'table'        => 'discount',
3                  'name_col'     => 'description',
4                  'order_by'     => 'ORDER BY discountnum', #XXX weight
5                  'value'        => $discountnum,
6                  'empty_label'  => '(none)',
7                  'hashref'      => $hashref,
8                  'post_options' => $post_options,
9                  %opt,
10              )
11 %>
12 <%init>
13
14 my %opt = @_;
15 my $discountnum = $opt{'curr_value'} || $opt{'value'};
16
17 $opt{'records'} = delete $opt{'discount'}
18   if $opt{'discount'};
19
20 my $curuser = $FS::CurrentUser::CurrentUser;
21
22 my $hashref = $opt{hashref} || { 'disabled' => '' };
23
24 my $post_options = [];
25 push @$post_options,  -1 => 'Custom discount'
26   if $curuser->access_right('Custom discount customer package')
27   && ! $opt{disable_custom_discount};
28
29 </%init>
30