[freeside-commits] branch FREESIDE_3_BRANCH updated. ad66b8e85a07f28adb3c8b5da7eff5ea69f31e62
Mark Wells
mark at 420.am
Thu Apr 9 22:58:43 PDT 2015
The branch, FREESIDE_3_BRANCH has been updated
via ad66b8e85a07f28adb3c8b5da7eff5ea69f31e62 (commit)
from f32c1ac0d63ea1f3967b7be045beb3cc34be0b4d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ad66b8e85a07f28adb3c8b5da7eff5ea69f31e62
Author: Mark Wells <mark at freeside.biz>
Date: Thu Apr 9 22:55:14 2015 -0700
future package change: let future package be modified in place, #20687, fixes #33782
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 6274d3f..8153bcc 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -2013,6 +2013,40 @@ sub change {
my $error;
+ if ( $opt->{'cust_location'} ) {
+ $error = $opt->{'cust_location'}->find_or_insert;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "creating location record: $error";
+ }
+ $opt->{'locationnum'} = $opt->{'cust_location'}->locationnum;
+ }
+
+ # Before going any further here: if the package is still in the pre-setup
+ # state, it's safe to modify it in place. No need to charge/credit for
+ # partial period, transfer services, transfer usage pools, copy invoice
+ # details, or change any dates.
+ if ( ! $self->setup and ! $opt->{cust_pkg} and ! $opt->{cust_main} ) {
+ foreach ( qw( locationnum pkgpart quantity refnum salesnum ) ) {
+ if ( length($opt->{$_}) ) {
+ $self->set($_, $opt->{$_});
+ }
+ }
+ # almost. if the new pkgpart specifies start/adjourn/expire timers,
+ # apply those.
+ if ( $opt->{'pkgpart'} and $opt->{'pkgpart'} != $self->pkgpart ) {
+ $self->set_initial_timers;
+ }
+ $error = $self->replace;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "modifying package: $error";
+ } else {
+ $dbh->commit if $oldAutoCommit;
+ return '';
+ }
+ }
+
my %hash = ();
my $time = time;
@@ -2023,15 +2057,6 @@ sub change {
$hash{"change_$_"} = $self->$_()
foreach qw( pkgnum pkgpart locationnum );
- if ( $opt->{'cust_location'} ) {
- $error = $opt->{'cust_location'}->find_or_insert;
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "creating location record: $error";
- }
- $opt->{'locationnum'} = $opt->{'cust_location'}->locationnum;
- }
-
if ( $opt->{'cust_pkg'} ) {
# treat changing to a package with a different pkgpart as a
# pkgpart change (because it is)
@@ -2078,6 +2103,9 @@ sub change {
# 2. (more importantly) changing a package before it's billed
$hash{'waive_setup'} = $self->waive_setup;
+ # if this package is scheduled for a future package change, preserve that
+ $hash{'change_to_pkgnum'} = $self->change_to_pkgnum;
+
my $custnum = $self->custnum;
if ( $opt->{cust_main} ) {
my $cust_main = $opt->{cust_main};
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_pkg.pm | 46 +++++++++++++++++++++++++++++++++++++---------
1 file changed, 37 insertions(+), 9 deletions(-)
More information about the freeside-commits
mailing list