projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d14aa44
)
option to keep dates when changing packages, RT#9947
author
mark
<mark>
Sun, 31 Oct 2010 04:41:00 +0000
(
04:41
+0000)
committer
mark
<mark>
Sun, 31 Oct 2010 04:41:00 +0000
(
04:41
+0000)
FS/FS/cust_pkg.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_pkg.pm
b/FS/FS/cust_pkg.pm
index
c810f13
..
c327ec6
100644
(file)
--- a/
FS/FS/cust_pkg.pm
+++ b/
FS/FS/cust_pkg.pm
@@
-1118,7
+1118,7
@@
Options are:
=over 4
=over 4
-=item loca
it
onnum
+=item loca
ti
onnum
New locationnum, to change the location for this package.
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>).
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
=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.
Returns either the new FS::cust_pkg object or a scalar error.
@@
-1195,6
+1201,13
@@
sub change {
$opt->{'locationnum'} = $opt->{'cust_location'}->locationnum;
}
$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,
# Create the new package.
my $cust_pkg = new FS::cust_pkg {
custnum => $self->custnum,
@@
-1244,7
+1257,7
@@
sub change {
? ()
: ( 'null' => 1 )
)
? ()
: ( '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;
if ($error) {
$dbh->rollback if $oldAutoCommit;