#24394 Pick specific package types on bulk changes
[freeside.git] / bin / part_pkg-bulk_change
index aecfea5..cf65c39 100755 (executable)
@@ -1,19 +1,22 @@
 #!/usr/bin/perl
 
 use strict;
-use vars qw( $opt_r $opt_o $opt_v );
+use vars qw( $opt_r $opt_p $opt_o $opt_v );
 use Getopt::Std;
 use FS::UID qw(adminsuidsetup);
 use FS::Record qw(qsearch qsearchs);
 use FS::part_pkg;
 use FS::part_pkg_option;
 
-getopts('ro:v:');
+getopts('rp:o:v:');
 
 my $user = shift or &usage;
 adminsuidsetup $user;
 
-foreach my $part_pkg ( qsearch('part_pkg', {}) ) {
+my %plan;
+%plan = ( 'plan' => $opt_p ) if $opt_p;
+
+foreach my $part_pkg ( qsearch('part_pkg',\%plan) ) {
   next if ! $part_pkg->freq && $opt_r;
 
   my %hash = (
@@ -50,7 +53,7 @@ cust_main-bulk_change
 
 =head1 DESCRIPTION
 
-Command-line tool to change the payby field for a group of customers.
+Command-line tool to change a set of package definitions.
 
 -r: recurring package definitions only