4 use vars qw( $opt_r $opt_o $opt_v );
6 use FS::UID qw(adminsuidsetup);
7 use FS::Record qw(qsearch qsearchs);
9 use FS::part_pkg_option;
13 my $user = shift or &usage;
16 foreach my $part_pkg ( qsearch('part_pkg', {}) ) {
17 next if ! $part_pkg->freq && $opt_r;
20 'pkgpart' => $part_pkg->pkgpart,
21 'optionname' => $opt_o,
24 my $part_pkg_option = qsearchs('part_pkg_option', \%hash);
26 if ( $part_pkg_option ) {
27 next if $part_pkg_option->optionvalue eq $opt_v;
28 $part_pkg_option->optionvalue($opt_v);
29 my $error = $part_pkg_option->replace;
32 $part_pkg_option = new FS::part_pkg_option { %hash, 'optionvalue'=>$opt_v };
33 my $error = $part_pkg_option->insert;
40 die "usage: part_pkg-bulk_change [ -r ] -o option_name -v option_value employee_username\n";
49 part_pkg-bulk_change [ -r ] -o option_name -v option_value employee_username
53 Command-line tool to change a set of package definitions.
55 -r: recurring package definitions only
57 -o: part_pkg_option optionname
59 -v: part_pkg_option optionvalue