[freeside-commits] branch FREESIDE_3_BRANCH updated. 5ae82b3b7576281c014af3ac6fc7c73ee3fcb6a0
Ivan
ivan at 420.am
Sun Jan 15 11:39:45 PST 2017
The branch, FREESIDE_3_BRANCH has been updated
via 5ae82b3b7576281c014af3ac6fc7c73ee3fcb6a0 (commit)
from ab83ed2eed479b689060e686098998df990dd140 (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 5ae82b3b7576281c014af3ac6fc7c73ee3fcb6a0
Author: Ivan Kohler <ivan at freeside.biz>
Date: Sun Jan 15 11:39:43 2017 -0800
fix package changes in pre-setup state, RT#73377, RT#38404
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index aedfe9c..98390c7 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -4395,24 +4395,42 @@ sub transfer {
my $error;
foreach my $cust_svc ($self->cust_svc) {
my $svcnum = $cust_svc->svcnum;
- if($target{$cust_svc->svcpart} > 0
- or $FS::cust_svc::ignore_quantity) { # maybe should be a 'force' option
+
+ if ( $target{$cust_svc->svcpart} > 0
+ or $FS::cust_svc::ignore_quantity # maybe should be a 'force' option
+ )
+ {
$target{$cust_svc->svcpart}--;
+
+ local $FS::cust_svc::ignore_quantity = 1
+ if $self->pkgnum == $dest->pkgnum;
+
+ #why run replace at all in the $self->pkgnum == $dest->pkgnum case?
+ # we do want to trigger location and pkg_change exports, but
+ # without pkgnum changing from an old to new package, cust_svc->replace
+ # doesn't know how to trigger those. :/
+ # does this mean we scrap the whole idea of "safe to modify it in place",
+ # or do we special-case and pass the info needed to cust_svc->replace? :/
+
my $new = new FS::cust_svc { $cust_svc->hash };
$new->pkgnum($dest_pkgnum);
$error = $new->replace($cust_svc);
+
} elsif ( exists $opt{'change_svcpart'} && $opt{'change_svcpart'} ) {
+
if ( $DEBUG ) {
warn "looking for alternates for svcpart ". $cust_svc->svcpart. "\n";
warn "alternates to consider: ".
join(', ', @{$svcpart2svcparts{$cust_svc->svcpart}}). "\n";
}
+
my @alternate = grep {
warn "considering alternate svcpart $_: ".
"$target{$_} available in new package\n"
if $DEBUG;
$target{$_} > 0;
} @{$svcpart2svcparts{$cust_svc->svcpart}};
+
if ( @alternate ) {
warn "alternate(s) found\n" if $DEBUG;
my $change_svcpart = $alternate[0];
@@ -4424,13 +4442,16 @@ sub transfer {
} else {
$remaining++;
}
+
} else {
$remaining++
}
+
if ( $error ) {
my @label = $cust_svc->label;
return "service $label[1]: $error";
}
+
}
return $remaining;
}
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_pkg.pm | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
More information about the freeside-commits
mailing list