summaryrefslogtreecommitdiff
path: root/FS/FS/quotation.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-04-25 15:02:15 -0700
committerMark Wells <mark@freeside.biz>2015-04-25 15:02:23 -0700
commitc110da0da864245e47cae019b8a347367cc6430c (patch)
treee406be890446095b8cd59a5b5c827c62dd063fff /FS/FS/quotation.pm
parent4fda726fa9f8e709c68ec823edc5ae702723281c (diff)
selfservice quotations, #33852
Diffstat (limited to 'FS/FS/quotation.pm')
-rw-r--r--FS/FS/quotation.pm34
1 files changed, 18 insertions, 16 deletions
diff --git a/FS/FS/quotation.pm b/FS/FS/quotation.pm
index f2a9620..45f3522 100644
--- a/FS/FS/quotation.pm
+++ b/FS/FS/quotation.pm
@@ -695,22 +695,24 @@ sub estimate {
# discounts
if ( $cust_bill_pkg->get('discounts') ) {
my $discount = $cust_bill_pkg->get('discounts')->[0];
- # discount records are generated as (setup, recur).
- # well, not always, sometimes it's just (recur), but fixing this
- # is horribly invasive.
- my $qpd = $quotation_pkg_discount{$quotationpkgnum}
- ||= qsearchs('quotation_pkg_discount', {
- 'quotationpkgnum' => $quotationpkgnum
- });
-
- if (!$qpd) { #can't happen
- warn "$me simulated bill returned a discount but no discount is in effect.\n";
- }
- if ($discount and $qpd) {
- if ( $i == 0 ) {
- $qpd->set('setup_amount', $discount->amount);
- } else {
- $qpd->set('recur_amount', $discount->amount);
+ if ( $discount ) {
+ # discount records are generated as (setup, recur).
+ # well, not always, sometimes it's just (recur), but fixing this
+ # is horribly invasive.
+ my $qpd = $quotation_pkg_discount{$quotationpkgnum}
+ ||= qsearchs('quotation_pkg_discount', {
+ 'quotationpkgnum' => $quotationpkgnum
+ });
+
+ if (!$qpd) { #can't happen
+ warn "$me simulated bill returned a discount but no discount is in effect.\n";
+ }
+ if ($discount and $qpd) {
+ if ( $i == 0 ) {
+ $qpd->set('setup_amount', $discount->amount);
+ } else {
+ $qpd->set('recur_amount', $discount->amount);
+ }
}
}
} # end of discount stuff