summaryrefslogtreecommitdiff
path: root/httemplate/view/cust_main/packages/package.html
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/view/cust_main/packages/package.html')
-rw-r--r--httemplate/view/cust_main/packages/package.html31
1 files changed, 19 insertions, 12 deletions
diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html
index 8aa64039c..e98b95e1c 100644
--- a/httemplate/view/cust_main/packages/package.html
+++ b/httemplate/view/cust_main/packages/package.html
@@ -53,10 +53,7 @@
(&nbsp;<%onetime_change_link($cust_pkg)%>&nbsp;)
% }
% # also, you can discount it
-% if ( $curuser->access_right('Discount customer package')
-% && ! scalar($cust_pkg->cust_pkg_discount_active)
-% && ! scalar($cust_pkg->part_pkg->part_pkg_discount)
-% ) {
+% if ( $can_discount_pkg ) {
(&nbsp;<%pkg_discount_link($cust_pkg)%>&nbsp;)
% }
<BR>
@@ -79,14 +76,7 @@
(&nbsp;<%pkg_change_link($cust_pkg)%>&nbsp;)
% }
%
-% if ( $curuser->access_right('Discount customer package')
-% && $part_pkg->can_discount
-% && ! scalar( @{ $cust_pkg->{_cust_pkg_discount_active} } )
-% && ( ! $opt{'term_discounts'}
-% || ! scalar($cust_pkg->part_pkg->part_pkg_discount)
-% )
-% )
-% {
+% if ( $can_discount_pkg ) {
% $br=1;
(&nbsp;<%pkg_discount_link($cust_pkg)%>&nbsp;)
% }
@@ -437,4 +427,21 @@ sub pkg_event_link {
'</a>';
}
+# figure out if this user will be able to edit either the setup or recurring
+# discounts for this package
+my $can_discount_pkg = (
+ $part_pkg->can_discount
+ and
+ ( ( $curuser->access_right(['Discount customer package', 'Waive setup fee'])
+ and $cust_pkg->base_setup > 0
+ and !$cust_pkg->setup
+ )
+ or
+ ( $curuser->access_right('Discount customer package')
+ and $cust_pkg->base_recur > 0
+ and $cust_pkg->freq ne '0'
+ )
+ )
+);
+
</%init>