summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Robinson <miker@freeside.biz>2012-04-27 15:57:41 -0500
committerMike Robinson <miker@freeside.biz>2012-04-27 15:57:41 -0500
commit8898d63f1a0be81775ecef61094d62129ea6ff38 (patch)
tree5e0532ef404cb2e217278743c3ed967bbcce0baa
parent044b23ad9f8294e6f0a11073fb9ae6aaf44ebad0 (diff)
Un-suspend e-mails (#16144)
-rw-r--r--FS/FS/cust_pkg.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 719189fa4..27cdc9ec8 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -1176,6 +1176,8 @@ sub unsuspend {
} #if $date
+ my @labels = ();
+
foreach my $cust_svc (
qsearch('cust_svc',{'pkgnum'=> $self->pkgnum } )
) {
@@ -1195,6 +1197,8 @@ sub unsuspend {
$dbh->rollback if $oldAutoCommit;
return $error;
}
+ my( $label, $value ) = $cust_svc->label;
+ push @labels, "$label: $value";
}
}
@@ -1225,6 +1229,29 @@ sub unsuspend {
return $error;
}
+ if ( $conf->config('unsuspend_email_admin') ) {
+
+ my $error = send_email(
+ 'from' => $conf->config('invoice_from', $self->cust_main->agentnum),
+ #invoice_from ??? well as good as any
+ 'to' => $conf->config('unsuspend_email_admin'),
+ 'subject' => 'FREESIDE NOTIFICATION: Customer package unsuspended', 'body' => [
+ "This is an automatic message from your Freeside installation\n",
+ "informing you that the following customer package has been unsuspended:\n",
+ "\n",
+ 'Customer: #'. $self->custnum. ' '. $self->cust_main->name. "\n",
+ 'Package : #'. $self->pkgnum. " (". $self->part_pkg->pkg_comment. ")\n",
+ ( map { "Service : $_\n" } @labels ),
+ ],
+ );
+
+ if ( $error ) {
+ warn "WARNING: can't send unsuspension admin email (unsuspending anyway): ".
+ "$error\n";
+ }
+
+ }
+
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
''; #no errors