[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 2726c70522a16a22f96abe5b1382b7741263641f
Ivan
ivan at 420.am
Thu Apr 12 15:13:52 PDT 2012
The branch, FREESIDE_2_3_BRANCH has been updated
via 2726c70522a16a22f96abe5b1382b7741263641f (commit)
from 0341c98727aa193623916901c476c04cceea7c9e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2726c70522a16a22f96abe5b1382b7741263641f
Author: Ivan Kohler <ivan at freeside.biz>
Date: Thu Apr 12 15:13:51 2012 -0700
adding quick package definition bulk change tool, RT#17348
diff --git a/bin/part_pkg-bulk_change b/bin/part_pkg-bulk_change
new file mode 100755
index 0000000..aecfea5
--- /dev/null
+++ b/bin/part_pkg-bulk_change
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+
+use strict;
+use vars qw( $opt_r $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:');
+
+my $user = shift or &usage;
+adminsuidsetup $user;
+
+foreach my $part_pkg ( qsearch('part_pkg', {}) ) {
+ next if ! $part_pkg->freq && $opt_r;
+
+ my %hash = (
+ 'pkgpart' => $part_pkg->pkgpart,
+ 'optionname' => $opt_o,
+ );
+
+ my $part_pkg_option = qsearchs('part_pkg_option', \%hash);
+
+ if ( $part_pkg_option ) {
+ next if $part_pkg_option->optionvalue eq $opt_v;
+ $part_pkg_option->optionvalue($opt_v);
+ my $error = $part_pkg_option->replace;
+ die $error if $error;
+ } else {
+ $part_pkg_option = new FS::part_pkg_option { %hash, 'optionvalue'=>$opt_v };
+ my $error = $part_pkg_option->insert;
+ die $error if $error;
+ }
+
+}
+
+sub usage {
+ die "usage: part_pkg-bulk_change [ -r ] -o option_name -v option_value employee_username\n";
+}
+
+=head1 NAME
+
+cust_main-bulk_change
+
+=head1 SYNOPSIS
+
+ part_pkg-bulk_change [ -r ] -o option_name -v option_value employee_username
+
+=head1 DESCRIPTION
+
+Command-line tool to change the payby field for a group of customers.
+
+-r: recurring package definitions only
+
+-o: part_pkg_option optionname
+
+-v: part_pkg_option optionvalue
+
+employee_username
+
+=head1 BUGS
+
+=head1 SEE ALSO
+
+L<FS::part_pkg>
+
+=cut
+
+1;
+
-----------------------------------------------------------------------
Summary of changes:
bin/part_pkg-bulk_change | 72 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 72 insertions(+), 0 deletions(-)
create mode 100755 bin/part_pkg-bulk_change
More information about the freeside-commits
mailing list