[freeside-commits] branch master updated. b17ce7c641ad897ec35cac0c8f8e69320c19ab0e

Ivan ivan at 420.am
Thu Apr 12 15:13:50 PDT 2012


The branch, master has been updated
       via  b17ce7c641ad897ec35cac0c8f8e69320c19ab0e (commit)
      from  902d15046334045b5f24c2d9e179b3db6e1ee3f4 (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 b17ce7c641ad897ec35cac0c8f8e69320c19ab0e
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Apr 12 15:13:49 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