[freeside-commits] branch master updated. 7dd79523c75c3cd238fb1c0cb7ccb346a6569811

Ivan ivan at 420.am
Fri Apr 20 14:25:52 PDT 2012


The branch, master has been updated
       via  7dd79523c75c3cd238fb1c0cb7ccb346a6569811 (commit)
       via  0eb70754e2fd9efe99ae8620489c675683daff91 (commit)
       via  460712dad66eac89cfdc9d09c8a9b31e32e20452 (commit)
       via  c7dfa5af7307e7b060a1fc68732ee1032f8ab208 (commit)
      from  28b2b233e588f03a9d7966f29db918ace9382d26 (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 7dd79523c75c3cd238fb1c0cb7ccb346a6569811
Merge: 0eb7075 28b2b23
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Apr 20 14:25:30 2012 -0700

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 0eb70754e2fd9efe99ae8620489c675683daff91
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Apr 20 14:25:02 2012 -0700

    add cust_pkg.bill reversion tool, RT#17479

diff --git a/bin/cust_pkg-revert b/bin/cust_pkg-revert
new file mode 100755
index 0000000..1a4d456
--- /dev/null
+++ b/bin/cust_pkg-revert
@@ -0,0 +1,118 @@
+#!/usr/bin/perl
+
+use strict;
+use vars qw( $opt_d $opt_u $opt_r );
+use Getopt::Std;
+use Date::Parse qw(str2time);
+use FS::UID qw(adminsuidsetup dbh);
+use FS::Record qw(qsearch qsearchs);
+use FS::cust_pkg;
+use FS::h_cust_pkg;
+
+getopts('d:u:r');
+
+my $user = shift or &usage;
+adminsuidsetup $user;
+
+my $sdate = str2time($opt_d);
+my $edate = $sdate + 86399;
+
+my $oldAutoCommit = $FS::UID::AutoCommit;
+local $FS::UID::AutoCommit = 0;
+my $dbh = dbh;
+
+my $fuzz = 1;
+
+my $changed = 0;
+
+foreach my $h_cust_pkg (
+  qsearch({ table       => 'h_cust_pkg',
+            hashref     => { history_user   => $opt_u,
+                             history_action => 'replace_new',
+                           },
+            extra_sql   => ' AND history_date >= ? AND history_date <= ? ',
+            extra_param => [ [$sdate,'int'], [$edate,'int'] ],
+            #order_by    => 'ORDER BY history_date asc',
+         })
+) {
+  my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $h_cust_pkg->pkgnum } );
+  next if $cust_pkg->get('cancel');
+
+  my($s, $e) = ($h_cust_pkg->history_date-$fuzz, $h_cust_pkg->history_date+$fuzz);
+
+  my $old = qsearchs({
+            table       => 'h_cust_pkg',
+            hashref     => { history_user   => $opt_u,
+                             history_action => 'replace_old',
+                             pkgnum         => $h_cust_pkg->pkgnum,
+                           },
+            extra_sql   => ' AND history_date >= ? AND history_date <= ? ',
+            extra_param => [ [$s,'int'], [$e,'int'] ],
+  });
+
+  my $diff = $h_cust_pkg->get('bill') - $old->get('bill');
+  if ( $diff < 0 ) {
+    warn "next bill date was decremented (not incremented) for pkgnum ". $cust_pkg->pkgnum. "; skipping\n";
+    next;
+  } elsif ( $diff == 0 ) {
+    warn "next bill date was not changed for pkgnum ". $cust_pkg->pkgnum. "; skipping\n";
+    next;
+  }
+
+  $changed++;
+
+  #if ( $opt_r ) {
+    my $days = ($diff / 86400);
+    print "decrementing next bill for pkgnum ". $cust_pkg->pkgnum.
+          " (custnum ". $cust_pkg->custnum. ") by $days days\n";
+  #}
+
+  $cust_pkg->set('bill', $cust_pkg->get('bill') - $diff );
+  my $error = $cust_pkg->replace;
+  die $error if $error;
+
+}
+
+if ( $opt_r ) {
+  $dbh->rollback or die $dbh->errstr; #if $oldAutoCommit;
+} else {
+  $dbh->commit or die $dbh->errstr; #if $oldAutoCommit;
+}
+
+print "changed $changed packages\n";
+
+sub usage {
+  die "usage: cust_pkg-revert -d date -u history_username [ -r ] employee_username\n";
+}
+
+=head1 NAME
+
+cust_pkg-revert
+
+=head1 SYNOPSIS
+
+  cust_pkg-revert -d date -u history_username [ -r ] employee_username
+
+=head1 DESCRIPTION
+
+Command-line tool to revert customer package changes from a specific day and user.
+Currently only incrementing the next bill date (cust_pkg.bill) is reverted.
+
+-d: Date of the changes to revert
+
+-u: Username of the changes to revert
+
+-r: dRy run
+
+employee_username
+
+=head1 BUGS
+
+=head1 SEE ALSO
+
+L<FS::part_pkg>
+
+=cut
+
+1;
+

commit 460712dad66eac89cfdc9d09c8a9b31e32e20452
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Apr 20 14:24:40 2012 -0700

    fix doc

diff --git a/bin/part_pkg-bulk_change b/bin/part_pkg-bulk_change
index aecfea5..64670de 100755
--- a/bin/part_pkg-bulk_change
+++ b/bin/part_pkg-bulk_change
@@ -50,7 +50,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
 

commit c7dfa5af7307e7b060a1fc68732ee1032f8ab208
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Apr 20 12:17:41 2012 -0700

    current AUTHORS in FS.pm

diff --git a/FS/FS.pm b/FS/FS.pm
index 830a4a4..3716212 100644
--- a/FS/FS.pm
+++ b/FS/FS.pm
@@ -546,11 +546,35 @@ Commercial support is available; see
 
 =head1 AUTHORS
 
-Primarily Ivan Kohler, with help from many kind folks, including core
-contributors Jeff Finucane, Kristian Hoffman, Jason Hall and Peter Bowen.
+=head2 CORE TEAM
 
-See the CREDITS file in the Freeside distribution for a (hopefully) complete
-list and the individal files for details.
+Jeremy Davis
+
+Ivan Kohler
+
+Mark Wells
+
+=head2 CORE EMERITUS
+
+Peter Bowen
+
+Jeff Finucane
+
+Jason Hall
+
+Kristian Hoffman
+
+Erik Levinson
+
+Brian McCane
+
+Richard Siddall
+
+Matt Simerson
+
+=head2 CONTRIBUTORS
+
+See httemplate/docs/credits.html
 
 =head1 SEE ALSO
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS.pm                 |   32 +++++++++++--
 bin/cust_pkg-revert      |  118 ++++++++++++++++++++++++++++++++++++++++++++++
 bin/part_pkg-bulk_change |    2 +-
 3 files changed, 147 insertions(+), 5 deletions(-)
 create mode 100755 bin/cust_pkg-revert




More information about the freeside-commits mailing list