summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-discount.html
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/elements/select-discount.html')
-rw-r--r--httemplate/elements/select-discount.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/httemplate/elements/select-discount.html b/httemplate/elements/select-discount.html
new file mode 100644
index 0000000..b7f1fa5
--- /dev/null
+++ b/httemplate/elements/select-discount.html
@@ -0,0 +1,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>
+