- # $amount is no longer permonth at this point! correct. very good.
- $discount_left = $amount - $recur_charge; # backward, as above
- if ( $discount_left > 0 ) {
- $amount = $recur_charge;
- $param->{'discount_left_setup'}{$discount->discountnum} =
- 0 - $discount_left;
+ # make sure there is a setup discount with this discountnum
+ # on the same package.
+ if ( qsearchs('cust_pkg_discount', {
+ pkgnum => $cust_pkg->pkgnum,
+ discountnum => $discount->discountnum,
+ setuprecur => 'setup'
+ }) )
+ {
+ # $amount is no longer permonth at this point! correct. very good.
+ $discount_left = $amount - $recur_charge; # backward, as above
+ if ( $discount_left > 0 ) {
+ $amount = $recur_charge;
+ $param->{'discount_left_setup'}{$discount->discountnum} =
+ 0 - $discount_left;
+ }