X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages%2Fpackage.html;h=0a5305ed5e7dd8c1ec3c079a67645ecd55fa00c6;hb=cd254e04ba204b5d0b4a69b65c392fb175dd1e97;hp=8aa64039c5d7c846cdb5b677f89f857413ecf8d0;hpb=98f6d91ec7eaa907204afbfeb90ede1e3bff656d;p=freeside.git
diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html
index 8aa64039c..0a5305ed5 100644
--- a/httemplate/view/cust_main/packages/package.html
+++ b/httemplate/view/cust_main/packages/package.html
@@ -53,10 +53,7 @@
( <%onetime_change_link($cust_pkg)%> )
% }
% # 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 ) {
( <%pkg_discount_link($cust_pkg)%> )
% }
@@ -79,14 +76,7 @@
( <%pkg_change_link($cust_pkg)%> )
% }
%
-% 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;
( <%pkg_discount_link($cust_pkg)%> )
% }
@@ -360,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,
- );
+ '' . emt('Modify one-time charge') . ''
}
sub pkg_change_location_link {
@@ -381,7 +365,7 @@ sub pkg_change_location_link {
'actionlabel' => emt('Change'),
'cust_pkg' => $cust_pkg,
'width' => 960,
- 'height' => 490,
+ 'height' => 530,
);
}
@@ -437,4 +421,27 @@ 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 = 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>