summaryrefslogtreecommitdiff
path: root/FS/FS
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:31 -0800
commit0070abc9190436fc6cc6ff908345bb24e19e388a (patch)
tree0b3ada6ca1babe0ad841862ede2271314403f8ee /FS/FS
parent3e14859be9589167b7d1dd4ab25457bca55e53b9 (diff)
allow back-billing by changing start dates, #38883
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/AccessRight.pm1
-rw-r--r--FS/FS/access_right.pm1
-rw-r--r--FS/FS/cust_main/Billing.pm13
3 files changed, 11 insertions, 4 deletions
diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index 04b9fba..0706235 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -152,6 +152,7 @@ tie my %rights, 'Tie::IxHash',
'View appointments', #NEWNEW
'Make appointment',
'View package definition costs', #NEWNEW
+ 'Change package start date',
],
###
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 40475ec..a17a157 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -255,6 +255,7 @@ sub _upgrade_data { # class method
'Unvoid credit' => 'Unvoid credit',
'Add on-the-fly void credit reason' => 'Add on-the-fly void credit reason',
'_ALL' => 'Employee preference telephony integration',
+ 'Edit customer package dates' => 'Change package start date', #4.x
);
# foreach my $old_acl ( keys %onetime ) {
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;