From: Jonathan Prykop Date: Mon, 13 Apr 2015 23:00:12 +0000 (-0500) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=a179189cab28d3c1b7ae0101df5c1a95c4a72003;hp=dd14eb402e7ed67d1f5ad63415bf169a3e79135b Merge branch 'master' of git.freeside.biz:/home/git/freeside --- diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index eaadd95db..3e87aadf5 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -2025,6 +2025,7 @@ sub change { my $unused_credit = 0; my $keep_dates = $opt->{'keep_dates'}; + # Special case. If the pkgpart is changing, and the customer is # going to be credited for remaining time, don't keep setup, bill, # or last_bill dates, and DO pass the flag to cancel() to credit @@ -2085,6 +2086,15 @@ sub change { $cust_pkg->set("change_$_", $self->get($_)); } $cust_pkg->set('change_date', $time); + $cust_pkg->set('start_date', ''); # it's starting now + # if we are crediting unused time, then create the new package as a new + # package, charge its setup fee, etc. (same as an immediate change) + if (! $unused_credit) { + foreach my $date ( qw(setup bill last_bill susp adjourn resume + contract_end ) ) { + $cust_pkg->set($date, $self->getfield($date)); + } + } $error = $cust_pkg->replace; } else {