summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main/Billing.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-12-31 17:44:04 -0800
committerMark Wells <mark@freeside.biz>2015-12-31 17:44:04 -0800
commitd0fc25693dd91869c6e1fe1372bcae35fde1a827 (patch)
tree40abd0862d419fd7faba658aee20a1988844e9db /FS/FS/cust_main/Billing.pm
parenta9a6fd37a49d05f451adfacc363d377009fd9672 (diff)
allow back-billing by changing start dates, #38883
Diffstat (limited to 'FS/FS/cust_main/Billing.pm')
-rw-r--r--FS/FS/cust_main/Billing.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 29535f2..1157ba9 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -1042,10 +1042,15 @@ sub _make_lines {
}
}
- $cust_pkg->setfield('setup', $time)
- unless $cust_pkg->setup;
- #do need it, but it won't get written to the db
- #|| $cust_pkg->pkgpart != $real_pkgpart;
+ if ( $cust_pkg->get('setup') ) {
+ # don't change it
+ } elsif ( $cust_pkg->get('start_date') ) {
+ # this allows start_date to be used to set the first bill date
+ $cust_pkg->set('setup', $cust_pkg->get('start_date'));
+ } else {
+ # if unspecified, start it right now
+ $cust_pkg->set('setup', $time);
+ }
$cust_pkg->setfield('start_date', '')
if $cust_pkg->start_date;