summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2018-04-23 17:09:04 -0700
committerIvan Kohler <ivan@freeside.biz>2018-04-23 17:09:04 -0700
commit8cc588676c49f81dc38449548517290b88a45862 (patch)
treefdc241597e781a78fc6bf72db93be02c007e00d2 /FS
parent694cd9058a9f1a89f0ffd2f2881ccc8491aebedb (diff)
bulk customer package edit from multiple source package definitions, RT#79885
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_pkg.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 7f1108f00..fa60afb45 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -3179,11 +3179,10 @@ sub process_bulk_cust_pkg {
my $param = thaw(decode_base64(shift));
warn Dumper($param) if $DEBUG;
- my $old_part_pkg = qsearchs('part_pkg',
- { pkgpart => $param->{'old_pkgpart'} });
my $new_part_pkg = qsearchs('part_pkg',
{ pkgpart => $param->{'new_pkgpart'} });
- die "Must select a new package type\n" unless $new_part_pkg;
+ die "Must select a new package definition\n" unless $new_part_pkg;
+
#my $keep_dates = $param->{'keep_dates'} || 0;
my $keep_dates = 1; # there is no good reason to turn this off
@@ -3198,7 +3197,14 @@ sub process_bulk_cust_pkg {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- my @cust_pkgs = qsearch('cust_pkg', { 'pkgpart' => $param->{'old_pkgpart'} } );
+ my @old_pkgpart = ref($param->{'old_pkgpart'}) ? @{ $param->{'old_pkgpart'} }
+ : $param->{'old_pkgpart'};
+
+ my @cust_pkgs = qsearch({
+ 'table' => 'cust_pkg',
+ 'extra_sql' => ' WHERE pkgpart IN ('.
+ join(',', @old_pkgpart). ')',
+ });
my $i = 0;
foreach my $old_cust_pkg ( @cust_pkgs ) {