summaryrefslogtreecommitdiff
path: root/FS/FS/cust_svc.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-04-30 06:52:43 -0700
committerIvan Kohler <ivan@freeside.biz>2015-04-30 06:52:43 -0700
commita9bd30b5b5231db37360e285fbbfa237195cd064 (patch)
treeffb3cc18b14fdafc8f9f0e0ab89b89610f5baf6a /FS/FS/cust_svc.pm
parentf1446e6af463609c1488ba367d437b728556f35a (diff)
service dependencies: cust_svc_suspend_cascade, RT#33685
Diffstat (limited to 'FS/FS/cust_svc.pm')
-rw-r--r--FS/FS/cust_svc.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm
index 5922e32..0465580 100644
--- a/FS/FS/cust_svc.pm
+++ b/FS/FS/cust_svc.pm
@@ -183,6 +183,37 @@ sub delete {
}
+=item suspend
+
+Suspends the relevant service by calling the B<suspend> method of the associated
+FS::svc_XXX object (i.e. an FS::svc_acct object or FS::svc_domain object).
+
+If there is an error, returns the error, otherwise returns false.
+
+=cut
+
+sub suspend {
+ my( $self, %opt ) = @_;
+
+ $self->part_svc->svcdb =~ /^([\w\-]+)$/ or return 'Illegal part_svc.svcdb';
+ my $svcdb = $1;
+ require "FS/$svcdb.pm";
+
+ my $svc = qsearchs( $svcdb, { 'svcnum' => $self->svcnum } )
+ or return '';
+
+ $error = $svc->suspend;
+ return $error if $error;
+
+ if ( $opt{labels_arryref} ) {
+ my( $label, $value ) = $self->label;
+ push @{ $opt{labels_arrayref} }, "$label: $value";
+ }
+
+ '';
+
+}
+
=item cancel
Cancels the relevant service by calling the B<cancel> method of the associated