X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fpart_pkg-bulk_change;h=24cf189158da647858e342e241ecc3e8f1c7d05e;hp=21a6c5ac32209a11d5823054465902295ccfa336;hb=51f97ec141f77064ca020634e7eccd85d9ead753;hpb=86f99dcdb9a51acc6865dc11b481f51377efecf6 diff --git a/bin/part_pkg-bulk_change b/bin/part_pkg-bulk_change index 21a6c5ac3..24cf18915 100755 --- a/bin/part_pkg-bulk_change +++ b/bin/part_pkg-bulk_change @@ -1,19 +1,23 @@ #!/usr/bin/perl use strict; -use vars qw( $opt_r $opt_o $opt_v $opt_t ); +use vars qw( $opt_r $opt_m $opt_p $opt_o $opt_v $opt_t $opt_s $opt_S $opt_z $opt_Z ); 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:t:'); +getopts('rm:p:o:v:t:sSzZ'); my $user = shift or &usage; adminsuidsetup $user; -foreach my $part_pkg ( qsearch('part_pkg', {}) ) { +my %search = (); +$search{'plan'} = $opt_p if $opt_p; +$search{'comment'} = $opt_m if $opt_m; + +foreach my $part_pkg ( qsearch('part_pkg',\%search) ) { next if ! $part_pkg->freq && $opt_r; if ( $opt_o ) { @@ -40,9 +44,14 @@ foreach my $part_pkg ( qsearch('part_pkg', {}) ) { } - if ( $opt_t ) { + if ( $opt_t || $opt_s || $opt_S || $opt_z || $opt_Z ) { + + $part_pkg->taxclass($opt_t) if $opt_t; + $part_pkg->setup_show_zero('') if $opt_s; + $part_pkg->setup_show_zero('Y') if $opt_S; + $part_pkg->recur_show_zero('') if $opt_z; + $part_pkg->recur_show_zero('Y') if $opt_Z; - $part_pkg->taxclass($opt_t); my $error = $part_pkg->replace; } @@ -50,7 +59,7 @@ foreach my $part_pkg ( qsearch('part_pkg', {}) ) { } sub usage { - die "usage: part_pkg-bulk_change [ -r ] [ -o option_name -v option_value ] [ -t new_taxclass ] employee_username\n"; + die "usage: part_pkg-bulk_change [ -r ] [ -p plan ] [ -m comment ] [ -o option_name -v option_value ] [ -t new_taxclass ] [ -s | -S ] [ -z | -Z ] employee_username\n"; } =head1 NAME @@ -59,7 +68,7 @@ cust_main-bulk_change =head1 SYNOPSIS - part_pkg-bulk_change [ -r ] [ -o option_name -v option_value ] [ -t new_taxclass ] employee_username + part_pkg-bulk_change [ -r ] [ -p plan ] [ -m comment ] [ -o option_name -v option_value ] [ -t new_taxclass ] [ -s | -S ] [ -z | -Z ] employee_username =head1 DESCRIPTION @@ -69,6 +78,10 @@ Search options: -r: recurring package definitions only +-p: packages with this price plan only + +-m: packages with this comment only + Change options: -o: part_pkg_option optionname @@ -77,6 +90,14 @@ Change options: -t: new taxclass +-s: Turn off "Show zero setup" + +-S: Turn on "Show zero setup" + +-z: Turn off "Show zero recurring" + +-Z: Turn on "Show zero recurring" + employee_username =head1 BUGS