diff options
author | Mike Robinson <miker@freeside.biz> | 2012-04-25 16:17:50 -0500 |
---|---|---|
committer | Mike Robinson <miker@freeside.biz> | 2012-04-25 16:28:34 -0500 |
commit | ca75ecc26c0e37dd951621de436bd74f581aa88f (patch) | |
tree | af919b80f58999d04c21f7c0a68683b4b16b7375 /FS/FS/cust_pkg.pm | |
parent | 5fd66da492a1b206fa4e944eb0caa2e2642d454a (diff) |
E-mail for un-suspension. (#16144)
Diffstat (limited to 'FS/FS/cust_pkg.pm')
-rw-r--r-- | FS/FS/cust_pkg.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 612ffa0f6..4359de9a4 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1239,6 +1239,8 @@ sub unsuspend { } #if $date + my @labels = (); + foreach my $cust_svc ( qsearch('cust_svc',{'pkgnum'=> $self->pkgnum } ) ) { @@ -1258,6 +1260,8 @@ sub unsuspend { $dbh->rollback if $oldAutoCommit; return $error; } + my( $label, $value ) = $cust_svc->label; + push @labels, "$label: $value"; } } @@ -1288,6 +1292,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 |