[freeside-commits] branch master updated. f81eebbe27a6acc0ae4284fa04b5525a41ae4570

Mitch Jackson mitch at freeside.biz
Tue Aug 14 17:31:43 PDT 2018


The branch, master has been updated
       via  f81eebbe27a6acc0ae4284fa04b5525a41ae4570 (commit)
       via  4c5f25435ed32c15a6c8078109b62654ff96797b (commit)
       via  2e2d726f93bb72ce1f79f011baaf98212e09f225 (commit)
       via  3cdf7e4e0b9f2b1ad44a45e1ab974f7a87372700 (commit)
       via  5ecde96d0a5948310cefbc423a6031d1c336315b (commit)
       via  0be3757937fc1df97ddb9771c79b758a95d4e23a (commit)
       via  c955f8e33cf8270f37b2d07e3920a30be33dd14a (commit)
       via  cd17fdd28e6fc14fcce521277a6aa65e322f9337 (commit)
       via  66006d4fd95324b9148c95fc3dcef1ced8096b5a (commit)
       via  bd7a4fa7a0fd966692d95b0f9cc7991a2a51310c (commit)
       via  0751f3ab8748fe06e3a5c018b15bf5aea3374970 (commit)
       via  d5d19730fdb7635bf1d4d4c65c06f1108db7f4ff (commit)
       via  b0c8b7e221d39eb13771e2870b21f4007deb0964 (commit)
      from  a3c654c1ae9ea07726aba9899a9b2e1d4dbd12c6 (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 f81eebbe27a6acc0ae4284fa04b5525a41ae4570
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Thu Aug 9 14:55:44 2018 -0400

    RT# 78547 bill_and_collect() small optimization

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 3bffa3a59..ea524dae4 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -5414,6 +5414,16 @@ sub process_bill_and_collect {
   $cust_main->bill_and_collect( %$param );
 }
 
+=item pending_invoice_count
+
+Return number of cust_bill with pending=Y for this customer
+
+=cut
+
+sub pending_invoice_count {
+  FS::cust_bill->count( 'custnum = '.shift->custnum."AND pending = 'Y'" );
+}
+
 #starting to take quite a while for big dbs
 #   (JRNL: journaled so it only happens once per database)
 # - seq scan of h_cust_main (yuck), but not going to index paycvv, so
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 9cf9b56c6..71d5c9b81 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -1,6 +1,7 @@
 package FS::cust_main::Billing;
 
 use strict;
+use feature 'state';
 use vars qw( $conf $DEBUG $me );
 use Carp;
 use Data::Dumper;
@@ -170,11 +171,8 @@ sub bill_and_collect {
 
   # In a batch tax environment, do not run collection if any pending 
   # invoices were created.  Collection will run after the next tax batch.
-  my $tax = FS::TaxEngine->new;
-  if ( $tax->info->{batch} and 
-       qsearch('cust_bill', { custnum => $self->custnum, pending => 'Y' })
-     )
-  {
+  state $is_batch_tax = FS::TaxEngine->new->info->{batch} ? 1 : 0;
+  if ( $is_batch_tax && $self->pending_invoice_count ) {
     warn "skipped collection for custnum ".$self->custnum.
          " due to pending invoices\n" if $DEBUG;
   } elsif ( $conf->exists('cancelled_cust-noevents')

commit 4c5f25435ed32c15a6c8078109b62654ff96797b
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 20:11:23 2018 -0400

    RT# 78547 noexport_hack part_svc::sqlradius

diff --git a/FS/FS/part_export/sqlradius.pm b/FS/FS/part_export/sqlradius.pm
index 9e65e51a6..926e36fdb 100644
--- a/FS/FS/part_export/sqlradius.pm
+++ b/FS/FS/part_export/sqlradius.pm
@@ -8,7 +8,7 @@ use FS::Record qw( dbh qsearch qsearchs str2time_sql str2time_sql_closing );
 use FS::part_export;
 use FS::svc_acct;
 use FS::export_svc;
-use Carp qw( cluck );
+use Carp qw( carp cluck );
 use NEXT;
 use Net::OpenSSH;
 
@@ -489,6 +489,12 @@ sub suspended_usergroups {
 }
 
 sub sqlradius_insert { #subroutine, not method
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_insert() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my( $table, $username, %attributes ) = @_;
 
@@ -527,6 +533,12 @@ sub sqlradius_insert { #subroutine, not method
 }
 
 sub sqlradius_usergroup_insert { #subroutine, not method
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_usergroup_insert() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my $username = shift;
   my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
@@ -565,6 +577,12 @@ sub sqlradius_usergroup_insert { #subroutine, not method
 }
 
 sub sqlradius_usergroup_delete { #subroutine, not method
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_usergroup_delete() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my $username = shift;
   my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
@@ -582,6 +600,12 @@ sub sqlradius_usergroup_delete { #subroutine, not method
 }
 
 sub sqlradius_rename { #subroutine, not method
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_rename() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my($new_username, $old_username) = (shift, shift);
   my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
@@ -595,6 +619,12 @@ sub sqlradius_rename { #subroutine, not method
 }
 
 sub sqlradius_attrib_delete { #subroutine, not method
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_attrib_delete() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my( $table, $username, @attrib ) = @_;
 
@@ -609,6 +639,12 @@ sub sqlradius_attrib_delete { #subroutine, not method
 }
 
 sub sqlradius_delete { #subroutine, not method
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_delete() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my $username = shift;
   my $usergroup = ( $_[0] =~ /^(rad)?usergroup/i ) ? shift : 'usergroup';
@@ -883,6 +919,12 @@ sub usage_sessions {
 sub update_svc {
   my $self = shift;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'update_svc() suppressed by noexport_hack'
+      if $self->option('debug') || $DEBUG;
+    return;
+  }
+
   my $conf = new FS::Conf;
 
   my $fdbh = dbh;
@@ -1048,6 +1090,13 @@ sub export_nas_replace { shift->export_nas_action('replace', @_); }
 sub export_nas_action {
   my $self = shift;
   my ($action, $new, $old) = @_;
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "export_nas_action($action) suppressed by noexport_hack"
+      if $self->option('debug') || $DEBUG;
+    return;
+  }
+
   # find the NAS in the target table by its name
   my $nasname = ($action eq 'replace') ? $old->nasname : $new->nasname;
   my $nasnum = $new->nasnum;
@@ -1061,6 +1110,12 @@ sub export_nas_action {
 }
 
 sub sqlradius_nas_insert {
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_nas_insert() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my %opt = @_;
   my $nas = qsearchs('nas', { nasnum => $opt{'nasnum'} })
@@ -1075,6 +1130,12 @@ VALUES (?, ?, ?, ?, ?, ?, ?)');
 }
 
 sub sqlradius_nas_delete {
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_nas_delete() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my %opt = @_;
   my $sth = $dbh->prepare('DELETE FROM nas WHERE nasname = ?');
@@ -1082,6 +1143,12 @@ sub sqlradius_nas_delete {
 }
 
 sub sqlradius_nas_replace {
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_nas_replace() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my %opt = @_;
   my $nas = qsearchs('nas', { nasnum => $opt{'nasnum'} })
@@ -1157,6 +1224,12 @@ sub export_attr_action {
 }
 
 sub sqlradius_attr_insert {
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_attr_insert() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my %opt = @_;
 
@@ -1180,6 +1253,12 @@ sub sqlradius_attr_insert {
 }
 
 sub sqlradius_attr_delete {
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_attr_delete() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my %opt = @_;
 
@@ -1231,6 +1310,12 @@ sub export_group_replace {
 }
 
 sub sqlradius_group_replace {
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_group_replace() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my $usergroup = shift;
   $usergroup =~ /^(rad)?usergroup$/
@@ -1271,6 +1356,12 @@ Note this is NOT the opposite of sqlradius_connect.
 =cut
 
 sub sqlradius_user_disconnect {
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'sqlradius_user_disconnect() suppressed by noexport_hack' if $DEBUG;
+    return;
+  }
+
   my $dbh = sqlradius_connect(shift, shift, shift);
   my %opt = @_;
   # get list of nas

commit 2e2d726f93bb72ce1f79f011baaf98212e09f225
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 19:57:38 2018 -0400

    RT# 78547 noexport_hack part_svc::sipwise

diff --git a/FS/FS/part_export/sipwise.pm b/FS/FS/part_export/sipwise.pm
index 9d4e3366e..287e604bd 100644
--- a/FS/FS/part_export/sipwise.pm
+++ b/FS/FS/part_export/sipwise.pm
@@ -14,6 +14,7 @@ use FS::Misc::DateTime qw(parse_datetime);
 use DateTime;
 use Number::Phone;
 use Try::Tiny;
+use Carp qw(carp);
 
 our $me = '[sipwise]';
 our $DEBUG = 0;
@@ -67,7 +68,7 @@ our %info = (
 END
 );
 
-sub export_insert {
+sub _export_insert {
   my($self, $svc_x) = (shift, shift);
 
   local $SIG{__DIE__};
@@ -88,7 +89,7 @@ sub export_insert {
   '';
 }
 
-sub export_replace {
+sub _export_replace {
   my ($self, $svc_new, $svc_old) = @_;
   local $SIG{__DIE__};
 
@@ -110,7 +111,7 @@ sub export_replace {
   '';
 }
 
-sub export_delete {
+sub _export_delete {
   my ($self, $svc_x) = (shift, shift);
   local $SIG{__DIE__};
 
@@ -135,7 +136,7 @@ sub export_delete {
 
 # logic to set subscribers to locked/active is in replace_subscriber
 
-sub export_suspend {
+sub _export_suspend {
   my $self = shift;
   my $svc_x = shift;
   my $role = $self->svc_role($svc_x);
@@ -148,7 +149,7 @@ sub export_suspend {
   '';
 }
 
-sub export_unsuspend {
+sub _export_unsuspend {
   my $self = shift;
   my $svc_x = shift;
   my $role = $self->svc_role($svc_x);
@@ -295,6 +296,13 @@ previously, and the one it's linked to now.
 sub export_did {
   my $self = shift;
   my ($new, $old) = @_;
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_did() suppressed by noexport_hack'
+      if $self->option('debug') || $DEBUG;
+    return;
+  }
+
   if ( $old and $new->forward_svcnum ne $old->forward_svcnum ) {
     my $old_svc_acct = $self->acct_for_did($old);
     $self->replace_subscriber( $old_svc_acct ) if $old_svc_acct;

commit 3cdf7e4e0b9f2b1ad44a45e1ab974f7a87372700
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 19:53:23 2018 -0400

    RT# 78547 noexport_hack part_export::shellcommands

diff --git a/FS/FS/part_export/shellcommands.pm b/FS/FS/part_export/shellcommands.pm
index 09fa71b94..7099ca8ac 100644
--- a/FS/FS/part_export/shellcommands.pm
+++ b/FS/FS/part_export/shellcommands.pm
@@ -7,6 +7,7 @@ use String::ShellQuote;
 use Net::OpenSSH;
 use FS::part_export;
 use FS::Record qw( qsearch qsearchs );
+use Carp qw(carp);
 
 @ISA = qw(FS::part_export);
 
@@ -267,6 +268,12 @@ sub _export_unsuspend {
 sub export_pkg_change {
   my( $self, $svc_acct, $new_cust_pkg, $old_cust_pkg ) = @_;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_pkg_change() suppressed by noexport_hack'
+      if $self->option('debug');
+    return;
+  }
+
   my @fields = qw( pkgnum pkgpart agent_pkgid ); #others?
   my @date_fields = qw( order_date start_date setup bill last_bill susp adjourn
                         resume cancel uncancel expire contract_end );
@@ -291,6 +298,13 @@ sub export_pkg_change {
 
 sub _export_command_or_super {
   my($self, $action) = (shift, shift);
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "_export_command_or_super($action) suppressed by noexport_hack"
+      if $self->option('debug');
+    return;
+  }
+
   if ( $self->option($action) =~ /^\s*$/ ) {
     my $method = "SUPER::_export_$action";
     $self->$method(@_);
@@ -303,6 +317,12 @@ sub _export_command {
   my ( $self, $action, $svc_acct) = (shift, shift, shift);
   my $command = $self->option($action);
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "_export_command($action) suppressed by noexport_hack"
+      if $self->option('debug');
+    return;
+  }
+
   return '' if $command =~ /^\s*$/;
   my $stdin = $self->option($action."_stdin");
 

commit 5ecde96d0a5948310cefbc423a6031d1c336315b
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 19:45:53 2018 -0400

    RT# 78547 noexport_hack part_svc::saisei

diff --git a/FS/FS/part_export/saisei.pm b/FS/FS/part_export/saisei.pm
index c79f79dac..1b7295d04 100644
--- a/FS/FS/part_export/saisei.pm
+++ b/FS/FS/part_export/saisei.pm
@@ -9,6 +9,7 @@ use MIME::Base64;
 use REST::Client;
 use Data::Dumper;
 use FS::Conf;
+use Carp qw(carp);
 
 =pod
 
@@ -245,6 +246,12 @@ sub _export_unsuspend {
 sub export_partsvc {
   my ($self, $svc_part) = @_;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_partsvc() suppressed by noexport_hack'
+      if $self->option('debug');
+    return;
+  }
+
   my $fcc_477_speeds;
   if ($svc_part->{Hash}->{svc_broadband__speed_down} eq "down" || $svc_part->{Hash}->{svc_broadband__speed_up} eq "up") {
     for my $type (qw( down up )) {
@@ -296,6 +303,12 @@ sub export_partsvc {
 sub export_tower_sector {
   my ($self, $tower) = @_;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_tower_sector() suppressed by noexport_hack'
+      if $self->option('debug');
+    return;
+  }
+
   #modify tower or create it.
   my $tower_name = $tower->{Hash}->{towername};
   $tower_name =~ s/\s/_/g;

commit 0be3757937fc1df97ddb9771c79b758a95d4e23a
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 19:43:41 2018 -0400

    RT# 78547 noexport_hack part_export::phone_shellcommands

diff --git a/FS/FS/part_export/phone_shellcommands.pm b/FS/FS/part_export/phone_shellcommands.pm
index 71445bf27..3f01de36b 100644
--- a/FS/FS/part_export/phone_shellcommands.pm
+++ b/FS/FS/part_export/phone_shellcommands.pm
@@ -5,6 +5,7 @@ use vars qw(@ISA %info);
 use Tie::IxHash;
 use String::ShellQuote;
 use FS::part_export;
+use Carp qw(carp);
 
 @ISA = qw(FS::part_export);
 
@@ -103,6 +104,12 @@ sub _export_command {
   my $command = $self->option($action);
   return '' if $command =~ /^\s*$/;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "_export_command($action) suppressed by noexport_hack"
+      if $self->option('debug');
+    return;
+  }
+
   #set variable for the command
   no strict 'vars';
   {

commit c955f8e33cf8270f37b2d07e3920a30be33dd14a
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 19:41:57 2018 -0400

    RT# 78547 noexport_hack part_svc::netsapiens

diff --git a/FS/FS/part_export/netsapiens.pm b/FS/FS/part_export/netsapiens.pm
index ac78dbca5..c6110f5ac 100644
--- a/FS/FS/part_export/netsapiens.pm
+++ b/FS/FS/part_export/netsapiens.pm
@@ -7,6 +7,7 @@ use Tie::IxHash;
 use Date::Format qw( time2str );
 use Regexp::Common qw( URI );
 use REST::Client;
+use Carp qw(carp);
 
 $me = '[FS::part_export::netsapiens]';
 
@@ -392,6 +393,12 @@ sub _export_unsuspend {
 sub export_device_insert {
   my( $self, $svc_phone, $phone_device ) = (shift, shift, shift);
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_device_insert() suppressed by noexport_hack'
+      if $self->option('debug');
+    return;
+  }
+
   my $domain = $self->ns_domain($svc_phone);
   my $countrycode = $svc_phone->countrycode;
   my $phonenum    = $svc_phone->phonenum;
@@ -426,6 +433,12 @@ sub export_device_insert {
 sub export_device_delete {
   my( $self, $svc_phone, $phone_device ) = (shift, shift, shift);
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_device_delete() suppressed by noexport_hack'
+      if $self->option('debug');
+    return;
+  }
+
   my $ns = $self->ns_device_command(
     'DELETE', $self->ns_device($svc_phone, $phone_device),
   );

commit cd17fdd28e6fc14fcce521277a6aa65e322f9337
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 19:37:07 2018 -0400

    RT# 78547 noexport_hack part_export::ikano

diff --git a/FS/FS/part_export/ikano.pm b/FS/FS/part_export/ikano.pm
index 23917bf9e..68b1a9fde 100644
--- a/FS/FS/part_export/ikano.pm
+++ b/FS/FS/part_export/ikano.pm
@@ -10,6 +10,7 @@ use FS::Record qw(qsearch qsearchs dbh);
 use FS::part_export;
 use FS::svc_dsl;
 use Data::Dumper;
+use Carp qw(carp);
 
 @ISA = qw(FS::part_export);
 $me= '[' .  __PACKAGE__ . ']';
@@ -678,7 +679,13 @@ sub _export_delete {
 
 sub export_expire {
   my($self, $svc_dsl, $date) = (shift, shift, shift);
-  
+
+  if ( $FS::svc_Common::noexport_hack ) {
+      carp 'export_expire() suppressed by noexport_hack'
+        if $self->option('debug');
+      return;
+  }
+
   return 'Invalid operation - Import Mode is enabled' if $self->import_mode;
 
   my $result = $self->valid_order($svc_dsl,'expire');

commit 66006d4fd95324b9148c95fc3dcef1ced8096b5a
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 19:34:50 2018 -0400

    RT# 78547 noexport_hack part_svc::http_status

diff --git a/FS/FS/part_export/http_status.pm b/FS/FS/part_export/http_status.pm
index 5c4a8d074..3e182d347 100644
--- a/FS/FS/part_export/http_status.pm
+++ b/FS/FS/part_export/http_status.pm
@@ -8,6 +8,7 @@ use URI::Escape;
 use LWP::UserAgent;
 use HTTP::Request::Common;
 use Email::Valid;
+use Carp qw(carp);
 
 tie my %options, 'Tie::IxHash',
   'url' => { label => 'URL', },
@@ -53,6 +54,12 @@ sub _export_delete  { '' };
 sub export_getstatus {
   my( $self, $svc_x, $htmlref, $hashref ) = @_;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_getstatus() suppressed by noexport_hack'
+      if $self->option('debug') || $DEBUG;
+    return;
+  }
+
   my $url;
   my $urlopt = $self->option('url');
   no strict 'vars';
@@ -131,6 +138,12 @@ sub export_setstatus_listdel {
 sub export_setstatus_listX {
   my( $self, $svc_x, $action, $list, $address_item ) = @_;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_setstatus_listX() suppressed by noexport_hack'
+      if $self->option('debug') || $DEBUG;
+    return;
+  }
+
   my $option;
   if ( $list =~ /^[WA]/i ) { #Whitelist/Allow
     $option = 'whitelist_';
@@ -182,6 +195,12 @@ sub export_setstatus_vacationdel {
 sub export_setstatus_vacationX {
   my( $self, $svc_x, $action, $hr ) = @_;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_setstatus_vacationX() suppressed by noexport_hack'
+      if $self->option('debug') || $DEBUG;
+    return;
+  }
+
   my $option = 'vacation_'. $action. '_url';
 
   my $subject = uri_escape($hr->{subject});
@@ -216,5 +235,3 @@ sub export_setstatus_vacationX {
 }
 
 1;
-
-1;

commit bd7a4fa7a0fd966692d95b0f9cc7991a2a51310c
Author: Mitch Jackson <mitch at mitchjacksontech.com>
Date:   Tue Aug 14 19:27:57 2018 -0400

    RT# 78547 noexport_hack - part_svc::grandstream

diff --git a/FS/FS/part_export/grandstream.pm b/FS/FS/part_export/grandstream.pm
index 5c6f1ed8d..981eb1969 100644
--- a/FS/FS/part_export/grandstream.pm
+++ b/FS/FS/part_export/grandstream.pm
@@ -7,6 +7,7 @@ use MIME::Base64;
 use Tie::IxHash;
 use IPC::Run qw(run);
 use FS::CGI qw(rooturl);
+use Carp qw(carp);
 
 $DEBUG = 0;
 
@@ -50,6 +51,12 @@ sub rebless { shift; }
 sub gs_create_config {
   my($self, $mac, %opt) = (@_);
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'gs_create_config() suppressed by noexport_hack'
+      if $self->option('debug') || $DEBUG;
+    return;
+  }
+
   eval "use Net::SCP;";
   die $@ if $@;
 
@@ -131,6 +138,12 @@ sub gs_create {
 sub gs_delete {
   my($self, $mac) = (shift, shift);
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'gs_delete() suppressed by noexport_hack'
+      if $self->option('debug') || $DEBUG;
+    return;
+  }
+
   $mac = sprintf('%012s', lc($mac));
 
   ssh_cmd( user => $self->option('user'),

commit 0751f3ab8748fe06e3a5c018b15bf5aea3374970
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Tue Aug 14 19:15:41 2018 -0400

    RT# 78547 noexport_hack - part_svc::broadworks

diff --git a/FS/FS/part_export/broadworks.pm b/FS/FS/part_export/broadworks.pm
index a04a70e9b..611bd00ec 100644
--- a/FS/FS/part_export/broadworks.pm
+++ b/FS/FS/part_export/broadworks.pm
@@ -6,6 +6,7 @@ use strict;
 use Tie::IxHash;
 use FS::Record qw(dbh qsearch qsearchs);
 use Locale::SubCountry;
+use Carp qw(carp);
 
 our $me = '[broadworks]';
 our %client; # exportnum => client object
@@ -46,7 +47,7 @@ Until then, authentication will be denied.</P>
 END
 );
 
-sub export_insert {
+sub _export_insert {
   my($self, $svc_x) = (shift, shift);
 
   my $cust_main = $svc_x->cust_main;
@@ -68,7 +69,7 @@ sub export_insert {
   '';
 }
 
-sub export_replace {
+sub _export_replace {
   my($self, $svc_new, $svc_old) = @_;
 
   my $cust_main = $svc_new->cust_main;
@@ -121,7 +122,7 @@ sub export_replace {
   '';
 }
 
-sub export_delete {
+sub _export_delete {
   my ($self, $svc_x) = @_;
 
   my $cust_main = $svc_x->cust_main;
@@ -162,6 +163,12 @@ sub export_delete {
 sub export_device_insert {
   my ($self, $svc_x, $device) = @_;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_device_insert() suppressed by noexport_hack'
+      if $self->option('debug');
+    return;
+  }
+
   if ( $device->count('svcnum = ?', $svc_x->svcnum) > 1 ) {
     return "This service already has a device.";
   }
@@ -181,6 +188,13 @@ sub export_device_insert {
 
 sub export_device_replace {
   my ($self, $svc_x, $new_device, $old_device) = @_;
+
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_device_replace() suppressed by noexport_hack'
+      if $self->option('debug');
+    return;
+  }
+
   my $cust_main = $svc_x->cust_main;
   my $groupId = $self->groupId($cust_main);
 
@@ -205,6 +219,12 @@ sub export_device_replace {
 sub export_device_delete {
   my ($self, $svc_x, $device) = @_;
 
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp 'export_device_delete() suppressed by noexport_hack'
+      if $self->option('debug');
+    return;
+  }
+
   if ( $device->isa('FS::phone_device') ) {
     my $error = $self->set_endpoint( $self->userId($svc_x), '' );
     return $error if $error;

commit d5d19730fdb7635bf1d4d4c65c06f1108db7f4ff
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Tue Aug 14 19:11:00 2018 -0400

    RT# 78547 - consolidate noexport_hack

diff --git a/FS/FS/part_export/a2billing.pm b/FS/FS/part_export/a2billing.pm
index 15410aebf..dbbd1bef8 100644
--- a/FS/FS/part_export/a2billing.pm
+++ b/FS/FS/part_export/a2billing.pm
@@ -105,7 +105,7 @@ sub replace {
   '';
 }
 
-sub export_insert {
+sub _export_insert {
   my $self = shift;
   my $svc = shift;
   my $cust_pkg = $svc->cust_svc->cust_pkg;
@@ -290,7 +290,7 @@ sub export_insert {
   '';
 }
 
-sub export_delete {
+sub _export_delete {
   my $self = shift;
   my $svc = shift;
 
@@ -376,7 +376,7 @@ sub export_delete {
   '';
 }
 
-sub export_replace {
+sub _export_replace {
   my $self = shift;
   my $new = shift;
   my $old = shift || $self->replace_old;
@@ -421,7 +421,7 @@ sub export_replace {
   '';
 }
 
-sub export_suspend {
+sub _export_suspend {
   my $self = shift;
   my $svc = shift;
 
@@ -446,7 +446,7 @@ sub export_suspend {
   $error || '';
 }
 
-sub export_unsuspend {
+sub _export_unsuspend {
   my $self = shift;
   my $svc = shift;
 
diff --git a/FS/FS/part_export/acct_opensrs.pm b/FS/FS/part_export/acct_opensrs.pm
index 51cee97a3..c131900d3 100644
--- a/FS/FS/part_export/acct_opensrs.pm
+++ b/FS/FS/part_export/acct_opensrs.pm
@@ -87,7 +87,7 @@ sub app {
   return;
 }
 
-sub export_insert {
+sub _export_insert {
   my $self = shift;
   my $new = shift;
   my $app = $self->app;
@@ -134,7 +134,7 @@ sub export_insert {
   }
 }
 
-sub export_delete {
+sub _export_delete {
   my $self = shift;
   my $old = shift;
   my $app = $self->app;
@@ -160,7 +160,7 @@ sub export_delete {
   }
 }
 
-sub export_replace {
+sub _export_replace {
   my $self = shift;
   my ($new, $old) = @_;
   my $app = $self->app;
@@ -222,7 +222,7 @@ sub export_replace {
   }
 }
 
-sub export_suspend {
+sub _export_suspend {
   my $self = shift;
   my $svc = shift;
   my $unsuspend = shift || 0;
@@ -243,7 +243,7 @@ sub export_suspend {
   return;
 }
 
-sub export_unsuspend {
+sub _export_unsuspend {
   my ($self, $svc) = @_;
   $self->export_suspend($svc, 1);
 }
diff --git a/FS/FS/part_export/aradial.pm b/FS/FS/part_export/aradial.pm
index c7356bf39..c5c55452c 100644
--- a/FS/FS/part_export/aradial.pm
+++ b/FS/FS/part_export/aradial.pm
@@ -41,7 +41,7 @@ service types, create another export instance.</p>
 '
 );
 
-sub export_insert {
+sub _export_insert {
   my ($self, $svc) = @_;
   my $result = $self->request_user_edit(
     'Add'   => 1,
@@ -54,7 +54,7 @@ sub export_insert {
   $result;
 }
 
-sub export_replace {
+sub _export_replace {
   my ($self, $new, $old) = @_;
   if ($new->email ne $old->email) {
     return $old->export_delete || $new->export_insert;
@@ -70,7 +70,7 @@ sub export_replace {
   );
 }
 
-sub export_suspend {
+sub _export_suspend {
   my ($self, $svc) = @_;
   $self->request_user_edit(
     'Modify'  => 1,
@@ -79,7 +79,7 @@ sub export_suspend {
   );
 }
 
-sub export_unsuspend {
+sub _export_unsuspend {
   my ($self, $svc) = @_;
   $self->request_user_edit(
     'Modify'  => 1,
@@ -88,7 +88,7 @@ sub export_unsuspend {
   );
 }
 
-sub export_delete {
+sub _export_delete {
   my ($self, $svc) = @_;
   $self->request_user_edit(
     'ConfirmDelete' => 1,
diff --git a/FS/FS/part_export/bandwidth_com.pm b/FS/FS/part_export/bandwidth_com.pm
index 6d868e640..b39bffb69 100644
--- a/FS/FS/part_export/bandwidth_com.pm
+++ b/FS/FS/part_export/bandwidth_com.pm
@@ -69,7 +69,7 @@ value, or a list of fixed values, for the sip_server field.</P>
 END
 );
 
-sub export_insert {
+sub _export_insert {
   my($self, $svc_phone) = (shift, shift);
   local $SIG{__DIE__};
   try {
@@ -100,7 +100,7 @@ sub export_insert {
   };
 }
 
-sub export_replace {
+sub _export_replace {
   my ($self, $new, $old) = @_;
   # we only export the IP address and the phone number,
   # neither of which we can change in place.
@@ -111,7 +111,7 @@ sub export_replace {
   '';
 }
 
-sub export_delete {
+sub _export_delete {
   my ($self, $svc_phone) = (shift, shift);
   local $SIG{__DIE__};
   try {
diff --git a/FS/FS/part_export/broadband_nas.pm b/FS/FS/part_export/broadband_nas.pm
index 8c152be45..d52ccae88 100644
--- a/FS/FS/part_export/broadband_nas.pm
+++ b/FS/FS/part_export/broadband_nas.pm
@@ -69,7 +69,7 @@ will be applied to the attached NAS record.
 
 =cut
 
-sub export_insert {
+sub _export_insert {
   my $self = shift;
   my $svc_broadband = shift;
   my %hash = (
@@ -103,7 +103,7 @@ sub export_insert {
   return;
 }
 
-sub export_delete {
+sub _export_delete {
   my $self = shift;
   my $svc_broadband = shift;
   my $svcnum = $svc_broadband->svcnum;
@@ -118,7 +118,7 @@ sub export_delete {
   return;
 }
 
-sub export_replace {
+sub _export_replace {
   my $self = shift;
   my ($new_svc, $old_svc) = (shift, shift);
 
diff --git a/FS/FS/part_export/broadband_snmp.pm b/FS/FS/part_export/broadband_snmp.pm
index 56d7816b2..8ebc716e7 100644
--- a/FS/FS/part_export/broadband_snmp.pm
+++ b/FS/FS/part_export/broadband_snmp.pm
@@ -62,27 +62,27 @@ svc_broadband fields may be prefixed with <b>$new_</b> and <b>$old_</b>
 END
 );
 
-sub export_insert {
+sub _export_insert {
   my $self = shift;
   $self->export_command('insert', @_);
 }
 
-sub export_delete {
+sub _export_delete {
   my $self = shift;
   $self->export_command('delete', @_);
 }
 
-sub export_replace {
+sub _export_replace {
   my $self = shift;
   $self->export_command('replace', @_);
 }
 
-sub export_suspend {
+sub _export_suspend {
   my $self = shift;
   $self->export_command('suspend', @_);
 }
 
-sub export_unsuspend {
+sub _export_unsuspend {
   my $self = shift;
   $self->export_command('unsuspend', @_);
 }
diff --git a/FS/FS/part_export/northern_911.pm b/FS/FS/part_export/northern_911.pm
index 027a52d21..679f5daf6 100644
--- a/FS/FS/part_export/northern_911.pm
+++ b/FS/FS/part_export/northern_911.pm
@@ -47,7 +47,7 @@ sub client {
   return $self->get('client');
 }
 
-sub export_insert {
+sub _export_insert {
   my( $self, $svc_phone ) = (shift, shift);
 
   my %location_hash = $svc_phone->location_hash;
@@ -98,7 +98,7 @@ sub export_insert {
   '';
 }
 
-sub export_replace {
+sub _export_replace {
   my( $self, $new, $old ) = (shift, shift, shift);
 
   # except when changing the phone number, exactly like export_insert;
@@ -109,7 +109,7 @@ sub export_replace {
   $self->export_insert($new);
 }
 
-sub export_delete {
+sub _export_delete {
   my ($self, $svc_phone) = (shift, shift);
 
   if ($self->option('debug')) {
diff --git a/FS/FS/part_export/thinktel.pm b/FS/FS/part_export/thinktel.pm
index 67cf2b0da..9ab645539 100644
--- a/FS/FS/part_export/thinktel.pm
+++ b/FS/FS/part_export/thinktel.pm
@@ -131,7 +131,7 @@ sub check_svc { # check the service for validity
   '';
 }
 
-sub export_insert {
+sub _export_insert {
   my($self, $svc_x) = (shift, shift);
 
   my $error = $self->check_svc($svc_x);
@@ -294,7 +294,7 @@ sub insert_trunk {
   }
 }
 
-sub export_replace {
+sub _export_replace {
   my ($self, $svc_new, $svc_old) = @_;
 
   my $error = $self->check_svc($svc_new);
@@ -412,7 +412,7 @@ sub replace_gateway {
   }
 }
 
-sub export_delete {
+sub _export_delete {
   my ($self, $svc_x) = (shift, shift);
 
   my $role = $self->svc_role($svc_x)
diff --git a/FS/FS/part_export/tower_towercoverage.pm b/FS/FS/part_export/tower_towercoverage.pm
index 5d3f8351a..ef8b266cf 100644
--- a/FS/FS/part_export/tower_towercoverage.pm
+++ b/FS/FS/part_export/tower_towercoverage.pm
@@ -102,7 +102,7 @@ sub insert {
   '';
 }
 
-sub export_insert {
+sub _export_insert {
   my ($self, $sector) = @_;
 
   return unless $self->option('use_coverage');
@@ -175,7 +175,7 @@ sub export_insert {
 
 }
 
-sub export_replace { # do the same thing as insert
+sub _export_replace { # do the same thing as insert
   my $self = shift;
   $self->export_insert(@_);
 }
diff --git a/FS/FS/part_export/voip_ms.pm b/FS/FS/part_export/voip_ms.pm
index 251988485..1eedd66ac 100644
--- a/FS/FS/part_export/voip_ms.pm
+++ b/FS/FS/part_export/voip_ms.pm
@@ -133,7 +133,7 @@ our %info = (
 END
 );
 
-sub export_insert {
+sub _export_insert {
   my($self, $svc_x) = (shift, shift);
 
   my $role = $self->svc_role($svc_x);
@@ -162,7 +162,7 @@ sub export_insert {
   '';
 }
 
-sub export_replace {
+sub _export_replace {
   my ($self, $svc_new, $svc_old) = @_;
   my $role = $self->svc_role($svc_new);
   my $error;
@@ -175,7 +175,7 @@ sub export_replace {
   '';
 }
 
-sub export_delete {
+sub _export_delete {
   my ($self, $svc_x) = (shift, shift);
   my $role = $self->svc_role($svc_x);
   if ( $role eq 'subacct' ) {
@@ -204,7 +204,7 @@ sub export_delete {
   '';
 }
 
-sub export_suspend {
+sub _export_suspend {
   my $self = shift;
   my $svc_x = shift;
   my $role = $self->svc_role($svc_x);
@@ -215,7 +215,7 @@ sub export_suspend {
   '';
 }
 
-sub export_unsuspend {
+sub _export_unsuspend {
   my $self = shift;
   my $svc_x = shift;
   my $role = $self->svc_role($svc_x);

commit b0c8b7e221d39eb13771e2870b21f4007deb0964
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Tue Aug 14 15:47:35 2018 -0400

    RT# 78547 - consolidate noexport_hack

diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
index 572a1b684..1a8f43de1 100644
--- a/FS/FS/part_export.pm
+++ b/FS/FS/part_export.pm
@@ -554,15 +554,19 @@ sub default_export_machine {
   die "no default export hostname for export ".$self->exportnum;
 }
 
-#these should probably all go away, just let the subclasses define em
-
 =item export_insert SVC_OBJECT
 
 =cut
 
+# Do not overload!  Overload _export_insert instead
+
 sub export_insert {
   my $self = shift;
   #$self->rebless;
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "export_insert() suppressed by noexport_hack" if $DEBUG;
+    return;
+  }
   $self->_export_insert(@_);
 }
 
@@ -579,9 +583,15 @@ sub export_insert {
 
 =cut
 
+# Do not overload!  Overload _export_replace instead
+
 sub export_replace {
   my $self = shift;
   #$self->rebless;
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "export_replace() suppressed by noexport_hack" if $DEBUG;
+    return;
+  }
   $self->_export_replace(@_);
 }
 
@@ -589,9 +599,15 @@ sub export_replace {
 
 =cut
 
+# Do not overload!  Overload _export_delete instead
+
 sub export_delete {
   my $self = shift;
   #$self->rebless;
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "export_delete() suppressed by noexport_hack" if $DEBUG;
+    return;
+  }
   $self->_export_delete(@_);
 }
 
@@ -599,9 +615,15 @@ sub export_delete {
 
 =cut
 
+# Do not overload!  Overload _export_suspend instead
+
 sub export_suspend {
   my $self = shift;
   #$self->rebless;
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "export_suspend() suppressed by noexport_hack" if $DEBUG;
+    return;
+  }
   $self->_export_suspend(@_);
 }
 
@@ -609,9 +631,15 @@ sub export_suspend {
 
 =cut
 
+# Do not overload!  Overload _export_unsuspend instead
+
 sub export_unsuspend {
   my $self = shift;
   #$self->rebless;
+  if ( $FS::svc_Common::noexport_hack ) {
+    carp "export_unsuspend() suppressed by noexport_hack" if $DEBUG;
+    return;
+  }
   $self->_export_unsuspend(@_);
 }
 

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

Summary of changes:
 FS/FS/cust_main.pm                       | 10 ++++
 FS/FS/cust_main/Billing.pm               |  8 ++-
 FS/FS/part_export.pm                     | 32 ++++++++++-
 FS/FS/part_export/a2billing.pm           | 10 ++--
 FS/FS/part_export/acct_opensrs.pm        | 10 ++--
 FS/FS/part_export/aradial.pm             | 10 ++--
 FS/FS/part_export/bandwidth_com.pm       |  6 +--
 FS/FS/part_export/broadband_nas.pm       |  6 +--
 FS/FS/part_export/broadband_snmp.pm      | 10 ++--
 FS/FS/part_export/broadworks.pm          | 26 +++++++--
 FS/FS/part_export/grandstream.pm         | 13 +++++
 FS/FS/part_export/http_status.pm         | 21 +++++++-
 FS/FS/part_export/ikano.pm               |  9 +++-
 FS/FS/part_export/netsapiens.pm          | 13 +++++
 FS/FS/part_export/northern_911.pm        |  6 +--
 FS/FS/part_export/phone_shellcommands.pm |  7 +++
 FS/FS/part_export/saisei.pm              | 13 +++++
 FS/FS/part_export/shellcommands.pm       | 20 +++++++
 FS/FS/part_export/sipwise.pm             | 18 +++++--
 FS/FS/part_export/sqlradius.pm           | 93 +++++++++++++++++++++++++++++++-
 FS/FS/part_export/thinktel.pm            |  6 +--
 FS/FS/part_export/tower_towercoverage.pm |  4 +-
 FS/FS/part_export/voip_ms.pm             | 10 ++--
 23 files changed, 303 insertions(+), 58 deletions(-)




More information about the freeside-commits mailing list