summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2018-04-23 17:09:01 -0700
committerIvan Kohler <ivan@freeside.biz>2018-04-23 17:09:01 -0700
commit7a1edaf0e681b1076b7500e5bcacca6e3629e043 (patch)
tree95149ed86e60f6cac9c7ee86e58c9d861646e429 /FS
parent2f27b25ce532ac7a0b12ba1043ddbd4d71899a11 (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 604b49941..399d13ece 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -3336,11 +3336,10 @@ sub process_bulk_cust_pkg {
my $param = 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
@@ -3348,7 +3347,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 ) {