[freeside-commits] branch FREESIDE_4_BRANCH updated. 53de6eb9d848a64a9e69e4a0cf0822f2b296a71b
Ivan
ivan at 420.am
Wed Mar 2 15:05:51 PST 2016
The branch, FREESIDE_4_BRANCH has been updated
via 53de6eb9d848a64a9e69e4a0cf0822f2b296a71b (commit)
from bfd986f4a210fe26768d77304d3fd50dd3334f45 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 53de6eb9d848a64a9e69e4a0cf0822f2b296a71b
Author: Ivan Kohler <ivan at freeside.biz>
Date: Wed Mar 2 15:05:50 2016 -0800
optimize customer package lists, RT#39822
diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html
index dec1c6f..e167e26 100644
--- a/httemplate/view/cust_main/packages/package.html
+++ b/httemplate/view/cust_main/packages/package.html
@@ -429,19 +429,25 @@ sub pkg_event_link {
# 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'
- )
- )
-);
+my $can_discount_pkg = 0;
+
+if ( $part_pkg->can_discount ) {
+ #looking these up individually uses the ACL cache and is a big win for lots
+ # of packages
+ my $discount = $curuser->access_right('Discount customer package');
+ my $waive = $curuser->access_right('Waive setup fee');
+
+ $can_discount_pkg =
+ ( ($discount || $waive)
+ && $cust_pkg->base_setup > 0
+ && !$cust_pkg->setup
+ or
+ ( $discount
+ && $cust_pkg->base_recur > 0
+ && $cust_pkg->freq ne '0'
+ )
+ );
+
+}
</%init>
-----------------------------------------------------------------------
Summary of changes:
httemplate/view/cust_main/packages/package.html | 34 +++++++++++++----------
1 file changed, 20 insertions(+), 14 deletions(-)
More information about the freeside-commits
mailing list