diff options
author | mark <mark> | 2010-10-31 04:41:00 +0000 |
---|---|---|
committer | mark <mark> | 2010-10-31 04:41:00 +0000 |
commit | f65ac395926a25b62af69a1b411ebc0147411f78 (patch) | |
tree | 4a931cdc03396144b6658dd1f4bba234bd6a9f20 | |
parent | d14aa44391dc7e2828fc6bab3f4032508fe5ea7a (diff) |
option to keep dates when changing packages, RT#9947
-rw-r--r-- | FS/FS/cust_pkg.pm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index c810f131f..c327ec635 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1118,7 +1118,7 @@ Options are: =over 4 -=item locaitonnum +=item locationnum New locationnum, to change the location for this package. @@ -1135,9 +1135,15 @@ New pkgpart (see L<FS::part_pkg>). New refnum (see L<FS::part_referral>). +=item keep_dates + +Set to true to transfer billing dates (start_date, setup, last_bill, bill, +susp, adjourn, cancel, expire, and contract_end) to the new package. + =back -At least one option must be specified (otherwise, what's the point?) +At least one of locationnum, cust_location, pkgpart, refnum must be specified +(otherwise, what's the point?) Returns either the new FS::cust_pkg object or a scalar error. @@ -1195,6 +1201,13 @@ sub change { $opt->{'locationnum'} = $opt->{'cust_location'}->locationnum; } + if ( $opt->{'keep_dates'} ) { + foreach my $date ( qw(setup bill last_bill susp adjourn cancel expire + start_date contract_end ) ) { + $hash{$date} = $self->getfield($date); + } + } + # Create the new package. my $cust_pkg = new FS::cust_pkg { custnum => $self->custnum, @@ -1244,7 +1257,7 @@ sub change { ? () : ( 'null' => 1 ) ) - if $part_pkg->can('reset_usage') && ! $part_pkg->option('usage_rollover'); + if $part_pkg->can('reset_usage') && ! $part_pkg->option('usage_rollover',1); if ($error) { $dbh->rollback if $oldAutoCommit; |