summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-12-30 18:51:09 -0800
committerMark Wells <mark@freeside.biz>2015-12-30 18:51:09 -0800
commit62e6a2b1c99086f3a9097f2d9d29fd8c414564b8 (patch)
tree786731c983966562e39e5905af31b56c319baf8e /FS
parent44e840908ac339de1c9d430e9565e03d4bfa5ec3 (diff)
add option for exports to avoid suspending services, #20739
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Schema.pm2
-rw-r--r--FS/FS/part_export.pm7
-rw-r--r--FS/FS/svc_Common.pm3
3 files changed, 12 insertions, 0 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index a10b5c023..56bdfc332 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -4487,6 +4487,8 @@ sub tables_hashref {
'exporttype', 'varchar', '', $char_d, '', '',
'nodomain', 'char', 'NULL', 1, '', '',
'default_machine','int', 'NULL', '', '', '',
+ 'no_suspend', 'char', 'NULL', 1, '', '',
+ # could also have 'no_insert', 'no_replace', etc.
],
'primary_key' => 'exportnum',
'unique' => [],
diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
index f3d977480..d6357fd73 100644
--- a/FS/FS/part_export.pm
+++ b/FS/FS/part_export.pm
@@ -58,6 +58,12 @@ fields are currently supported:
=item nodomain - blank or "Y" : usernames are exported to this service with no domain
+=item default_machine - For exports that require a machine to be selected for
+each service (see L<FS::svc_export_machine>), the one to use as the default.
+
+=item no_suspend - Don't export service suspensions. In the future there may
+be "no_*" options for the other service actions.
+
=back
=head1 METHODS
@@ -337,6 +343,7 @@ sub check {
|| $self->ut_textn('exportname')
|| $self->ut_domainn('machine')
|| $self->ut_alpha('exporttype')
+ || $self->ut_flag('no_suspend')
;
if ( $self->machine eq '_SVC_MACHINE' ) {
diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index 35415a26f..73658f67a 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -1154,7 +1154,9 @@ Runs the provided export hook (i.e. "suspend", "unsuspend") for this service.
sub export {
my( $self, $method ) = ( shift, shift );
+ # $method must start with export_, $action must be the part after that
$method = "export_$method" unless $method =~ /^export_/;
+ my ($action) = $method =~ /^export_(\w+)/;
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
@@ -1171,6 +1173,7 @@ sub export {
unless ( $noexport_hack ) {
foreach my $part_export ( $self->cust_svc->part_svc->part_export ) {
next unless $part_export->can($method);
+ next if $part_export->get("no_$action"); # currently only 'no_suspend'
my $error = $part_export->$method($self, @_);
if ( $error ) {
$dbh->rollback if $oldAutoCommit;