X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages%2Fpackage.html;h=0a5305ed5e7dd8c1ec3c079a67645ecd55fa00c6;hb=ca00b528d98dbf454bae7b497c8d83ca8851724c;hp=e98b95e1c3d4de607c97579b8ba0eb65e0e706ec;hpb=f641486e28214ad1eca18c47d2252701b83614f1;p=freeside.git

diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html
index e98b95e1c..0a5305ed5 100644
--- a/httemplate/view/cust_main/packages/package.html
+++ b/httemplate/view/cust_main/packages/package.html
@@ -350,14 +350,8 @@ sub pkg_change_link {
 sub onetime_change_link {
   my $cust_pkg = shift;
   my $pkgnum = $cust_pkg->pkgnum;
-  include( '/elements/popup_link-cust_pkg.html',
-    'action'      => $p. "edit/quick-charge.html?change_pkgnum=$pkgnum",
-    'label'       => emt('Modify one-time charge'),
-    'actionlabel' => emt('Modify'),
-    'cust_pkg'    => $cust_pkg,
-    'width'       => 690,
-    'height'      => 440,
-  );
+  '<A HREF="' . $fsurl . "edit/quick-charge.html?change_pkgnum=$pkgnum" .
+  '">' . emt('Modify one-time charge') . '</A>'
 }
 
 sub pkg_change_location_link {
@@ -371,7 +365,7 @@ sub pkg_change_location_link {
     'actionlabel' => emt('Change'),
     'cust_pkg'    => $cust_pkg,
     'width'       => 960,
-    'height'      => 490,
+    'height'      => 530,
   );
 }
 
@@ -429,19 +423,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>