[freeside-commits] freeside/FS/FS Conf.pm, 1.180.2.34, 1.180.2.35 cust_pkg.pm, 1.73.2.23, 1.73.2.24
Ivan,,,
ivan at wavetail.420.am
Fri Oct 10 17:32:23 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv8059
Modified Files:
Tag: FREESIDE_1_7_BRANCH
Conf.pm cust_pkg.pm
Log Message:
enable suspension notices to an administrator, RT#4083
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.180.2.34
retrieving revision 1.180.2.35
diff -u -d -r1.180.2.34 -r1.180.2.35
--- Conf.pm 12 Sep 2008 07:58:34 -0000 1.180.2.34
+++ Conf.pm 11 Oct 2008 00:32:21 -0000 1.180.2.35
@@ -2387,6 +2387,13 @@
'type' => 'text',
},
+ {
+ 'key' => 'suspend_email_admin',
+ 'section' => '',
+ 'description' => 'Destination admin email address to enable suspension notices',
+ 'type' => 'text',
+ },
+
);
1;
Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.73.2.23
retrieving revision 1.73.2.24
diff -u -d -r1.73.2.23 -r1.73.2.24
--- cust_pkg.pm 10 Oct 2008 23:36:17 -0000 1.73.2.23
+++ cust_pkg.pm 11 Oct 2008 00:32:21 -0000 1.73.2.24
@@ -672,6 +672,9 @@
}
unless ( $date ) {
+
+ my @labels = ();
+
foreach my $cust_svc (
qsearch( 'cust_svc', { 'pkgnum' => $self->pkgnum } )
) {
@@ -691,12 +694,43 @@
$dbh->rollback if $oldAutoCommit;
return $error;
}
+ my( $label, $value ) = $cust_svc->label;
+ push @labels, "$label: $value";
+ }
+ }
+
+ my $conf = new FS::Conf;
+ if ( $conf->config('suspend_email_admin') ) {
+
+ my $error = send_email(
+ 'from' => $conf->config('invoice_from'), #??? well as good as any
+ 'to' => $conf->config('suspend_email_admin'),
+ 'subject' => 'FREESIDE NOTIFICATION: Customer package suspended',
+ 'body' => [
+ "This is an automatic message from your Freeside installation\n",
+ "informing you that the following customer package has been suspended:\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 suspension admin email (suspending anyway): ".
+ "$error\n";
}
+
}
+
}
my %hash = $self->hash;
- $date ? ($hash{'adjourn'} = $date) : ($hash{'susp'} = time);
+ if ( $date ) {
+ $hash{'adjourn'} = $date;
+ } else {
+ $hash{'susp'} = time;
+ }
my $new = new FS::cust_pkg ( \%hash );
$error = $new->replace( $self, options => { $self->options } );
if ( $error ) {
More information about the freeside-commits
mailing list