projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bf6c11b
)
fix unit setup fee on prorate-deferred packages, #31276
author
Mark Wells
<mark@freeside.biz>
Fri, 2 Oct 2015 23:05:41 +0000
(16:05 -0700)
committer
Mark Wells
<mark@freeside.biz>
Fri, 2 Oct 2015 23:05:41 +0000
(16:05 -0700)
FS/FS/cust_main/Billing.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_main/Billing.pm
b/FS/FS/cust_main/Billing.pm
index
2d7b690
..
eee0958
100644
(file)
--- a/
FS/FS/cust_main/Billing.pm
+++ b/
FS/FS/cust_main/Billing.pm
@@
-1024,8
+1024,14
@@
sub _make_lines {
return "$@ running calc_setup for $cust_pkg\n"
if $@;
return "$@ running calc_setup for $cust_pkg\n"
if $@;
- $unitsetup = $cust_pkg->base_setup()
- || $setup; #XXX uuh
+ # Only increment unitsetup here if there IS a setup fee.
+ # prorate_defer_bill may cause calc_setup on a setup-stage package
+ # to return zero, and the setup fee to be charged later. (This happens
+ # when it's first billed on the prorate cutoff day. RT#31276.)
+ if ( $setup ) {
+ $unitsetup = $cust_pkg->base_setup()
+ || $setup; #XXX uuh
+ }
if ( $setup_param{'billed_currency'} ) {
$setup_billed_currency = delete $setup_param{'billed_currency'};
if ( $setup_param{'billed_currency'} ) {
$setup_billed_currency = delete $setup_param{'billed_currency'};
@@
-1196,7
+1202,7
@@
sub _make_lines {
# Add an additional setup fee at the billing stage.
# Used for prorate_defer_bill.
$setup += $param{'setup_fee'};
# Add an additional setup fee at the billing stage.
# Used for prorate_defer_bill.
$setup += $param{'setup_fee'};
- $unitsetup
+= $param{'setup_fee'}
;
+ $unitsetup
= $cust_pkg->base_setup()
;
$lineitems++;
}
$lineitems++;
}