[freeside-commits] branch FREESIDE_3_BRANCH updated. 5000d886f3c9d7b57e6dd36431223a1ba1e200a0

Mark Wells mark at 420.am
Tue May 10 13:11:18 PDT 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  5000d886f3c9d7b57e6dd36431223a1ba1e200a0 (commit)
       via  1d37922a192f776936d9aeb654064df3eb9b1c2c (commit)
       via  87a7b7029f3d71c7cbb625ec61f8e18ab3edb40d (commit)
      from  29511cc57e60f40a231aa8e1dc3239869ea14410 (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 5000d886f3c9d7b57e6dd36431223a1ba1e200a0
Merge: 1d37922 29511cc
Author: Mark Wells <mark at freeside.biz>
Date:   Tue May 10 13:11:10 2016 -0700

    Merge branch 'FREESIDE_3_BRANCH' of git.freeside.biz:/home/git/freeside into 3.x


commit 1d37922a192f776936d9aeb654064df3eb9b1c2c
Author: Mark Wells <mark at freeside.biz>
Date:   Tue May 10 12:57:54 2016 -0700

    fix voided invoice report vs. customer classes, similar to #37243

diff --git a/httemplate/search/report_cust_bill_void.html b/httemplate/search/report_cust_bill_void.html
index cb13b78..9e9f590 100644
--- a/httemplate/search/report_cust_bill_void.html
+++ b/httemplate/search/report_cust_bill_void.html
@@ -24,7 +24,7 @@
       label         => mt('Customer Class'),
       field         => 'cust_classnum',
       multiple      => 1,
-     'pre_options'  => [ '' => emt('(none)') ],
+     'pre_options'  => [ '0' => emt('(none)') ],
      'all_selected' => 1,
   &>
 

commit 87a7b7029f3d71c7cbb625ec61f8e18ab3edb40d
Author: Mark Wells <mark at freeside.biz>
Date:   Tue May 10 12:57:18 2016 -0700

    bulk void script, #42360

diff --git a/bin/bulk_void b/bin/bulk_void
new file mode 100755
index 0000000..a142818
--- /dev/null
+++ b/bin/bulk_void
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+use FS::Misc::Getopt;
+use FS::Record qw(qsearch qsearchs dbh);
+
+getopts('cpifXr:');
+my $dbh = dbh;
+$FS::UID::AutoCommit = 0;
+
+sub usage() {
+  "Usage: bulk_void  -s start -e end
+                  -r void_reason
+                  { -c | -p | -i }
+                  [ -X ]
+                  <user>
+-s, -e: date range (required)
+-r: void reason text (required)
+-c, -p, -i, -f: void credits, payments, invoices
+-X: commit changes
+";
+}
+
+if (!$opt{start} or !$opt{end} or !$opt{r}) {
+  die usage;
+}
+
+print "DRY RUN--changes will not be committed.\n" unless $opt{X};
+
+my $date = " WHERE _date >= $opt{start} AND _date <= $opt{end}";
+
+my %tables = (
+  c => 'cust_credit',
+  p => 'cust_pay',
+  i => 'cust_bill',
+);
+
+my $reason = $opt{r};
+
+foreach my $k (keys %tables) {
+  next unless $opt{$k};
+  my $table = $tables{$k};
+  debug("$table:");
+  my $done_count = 0;
+  my $error_count = 0;
+
+  my $cursor = FS::Cursor->new({
+    table     => $table,
+    extra_sql => $date,
+  });
+  my $error;
+  while (my $record = $cursor->fetch) {
+    $error = $record->void($reason);
+    if ( $error ) {
+      $error = "$table #" . $record->get($record->primary_key) . ": $error";
+      print "$error\n";
+      $error_count++;
+      if ( $opt{X} ) {
+        $dbh->rollback;
+        exit(1);
+      }
+    } else {
+      $done_count++;
+    }
+  }
+  print " $table voided: $done_count\n errors: $error_count\n";
+}
+
+if ( $opt{X} ) {
+  $dbh->commit;
+  print "Committed changes.\n";
+} else {
+  $dbh->rollback;
+  print "Reverted changes.\n";
+}
+

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

Summary of changes:
 bin/bulk_void                                |   75 ++++++++++++++++++++++++++
 httemplate/search/report_cust_bill_void.html |    2 +-
 2 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100755 bin/bulk_void




More information about the freeside-commits mailing list