diff options
author | Mark Wells <mark@freeside.biz> | 2015-10-16 15:32:32 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-10-16 15:48:16 -0700 |
commit | 05cc1ce102266aa0a25e085b0b39d777686210a6 (patch) | |
tree | e2d9e64f6b357453e83c482a6c279d21abe8da0d /httemplate/view | |
parent | 8f086c4f68684d696ab64ccfab797272111d3ce4 (diff) |
separate setup and recur discounts, #14092
Diffstat (limited to 'httemplate/view')
-rwxr-xr-x | httemplate/view/cust_main/packages.html | 1 | ||||
-rw-r--r-- | httemplate/view/cust_main/packages/package.html | 31 | ||||
-rw-r--r-- | httemplate/view/cust_main/packages/status.html | 31 |
3 files changed, 40 insertions, 23 deletions
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 4903e185b..0c67843d4 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -42,6 +42,7 @@ table.hiddenrows { z-index: 1; text-align: center; } + </STYLE> % # activate rolldown buttons for hidden package blocks <SCRIPT TYPE="text/javascript"> 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 @@ ( <%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)%> ) % } <BR> @@ -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)%> ) % } @@ -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> diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html index 7e125f72e..13bd2024b 100644 --- a/httemplate/view/cust_main/packages/status.html +++ b/httemplate/view/cust_main/packages/status.html @@ -461,10 +461,11 @@ sub pkg_status_row_changed { my $part_pkg = $old->part_pkg; $html .= pkg_status_row_colspan( $cust_pkg, - emt("Changed from [_1]: [_2]", - $cust_pkg->change_pkgnum, - $part_pkg->pkg_comment(cust_pkg=>$old, nopartpkg=>1) - ), +# emt("Changed from [_1]: [_2]", +# $cust_pkg->change_pkgnum, +# $part_pkg->pkg_comment(cust_pkg=>$old, nopartpkg=>1) +# ), + '', '', 'size' => '-1', 'align' => 'right', @@ -529,17 +530,25 @@ sub pkg_status_row_discount { my $discount = $cust_pkg_discount->discount; - my $label = '<B>'.emt('Discount').'</B>: '. $discount->description; - if ( $discount->months ) { + my $label = '<SPAN STYLE="font-size: small"><B>'; + if ( $cust_pkg_discount->setuprecur eq 'setup' ) { + $label .= emt('Setup Discount'); + } else { + $label .= emt('Recurring Discount'); + } + $label .= '</B>: '. $discount->description; + warn Dumper $cust_pkg_discount; + if ( $discount->months > 0 and $cust_pkg_discount->months_used > 0 ) { my $remaining = $discount->months - $cust_pkg_discount->months_used; $remaining = sprintf('%.2f', $remaining) if $remaining =~ /\./; - $label .= emt("([_1] months remaining)",$remaining); + $label .= <br> . emt("([_1] months remaining)",$remaining); } + $label .= '</SPAN>'; - $label .= ' <FONT SIZE="-1">('. - '<A HREF="../misc/delete-cust_pkg_discount.html?'. - $cust_pkg_discount->pkgdiscountnum. - '">'.emt('remove discount').'</A>)</FONT>'; + #$label .= ' <FONT SIZE="-1">('. + # '<A HREF="../misc/delete-cust_pkg_discount.html?'. + # $cust_pkg_discount->pkgdiscountnum. + # '">'.emt('remove discount').'</A>)</FONT>'; $html .= pkg_status_row_colspan( $cust_pkg, $label, '', %opt ); |