[freeside-commits] branch master updated. ca75ecc26c0e37dd951621de436bd74f581aa88f

Mike Robinson miker at 420.am
Wed Apr 25 14:34:58 PDT 2012


The branch, master has been updated
       via  ca75ecc26c0e37dd951621de436bd74f581aa88f (commit)
      from  5fd66da492a1b206fa4e944eb0caa2e2642d454a (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 ca75ecc26c0e37dd951621de436bd74f581aa88f
Author: Mike Robinson <miker at freeside.biz>
Date:   Wed Apr 25 16:17:50 2012 -0500

    E-mail for un-suspension.  (#16144)

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 8144363..31999bc 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3952,6 +3952,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'unsuspend_email_admin',
+    'section'     => '',
+    'description' => 'Destination admin email address to enable unsuspension notices',
+    'type'        => 'text',
+  },
+  
+  {
     'key'         => 'email_report-subject',
     'section'     => '',
     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
diff --git a/FS/FS/Conf_compat17.pm b/FS/FS/Conf_compat17.pm
index 6685935..2e4bb05 100644
--- a/FS/FS/Conf_compat17.pm
+++ b/FS/FS/Conf_compat17.pm
@@ -2458,6 +2458,13 @@ httemplate/docs/config.html
   },
 
   {
+    'key'         => 'unsuspend_email_admin',
+    'section'     => '',
+    'description' => 'Destination admin email address to enable unsuspension notices',
+    'type'        => 'text',
+  },
+  
+  {
     'key'         => 'email_report-subject',
     'section'     => '',
     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 612ffa0..4359de9 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

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

Summary of changes:
 FS/FS/Conf.pm          |    7 +++++++
 FS/FS/Conf_compat17.pm |    7 +++++++
 FS/FS/cust_pkg.pm      |   27 +++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 0 deletions(-)




More information about the freeside-commits mailing list