summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/Conf.pm35
-rw-r--r--FS/FS/cust_bill.pm5
-rw-r--r--FS/FS/cust_pkg.pm44
-rw-r--r--fs_selfservice/freeside-selfservice-server11
4 files changed, 93 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index e805c8ee7..fcc150cd4 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -894,6 +894,20 @@ httemplate/docs/config.html
},
{
+ 'key' => 'selfservice_server-quiet',
+ 'section' => '',
+ 'description' => 'Disable decline and cancel emails generated by transactions initiated by the selfservice server. Not recommended, unless the customer will get instant feedback from a customer service UI, and receiving an email would be confusing/overkill.',
+ 'type' => 'checkbox',
+ },
+
+ {
+ 'key' => 'signup_server-quiet',
+ 'section' => '',
+ 'description' => 'Disable decline and cancel emails generated by transactions initiated by the signup server. Not recommended, unless the customer will get instant feedback from a customer service UI, and receiving an email would be confusing/overkill. Does not disable welcome emails.',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'signup_server-payby',
'section' => '',
'description' => 'Acceptable payment types for the signup server',
@@ -938,6 +952,27 @@ httemplate/docs/config.html
},
{
+ 'key' => 'cancelmessage',
+ 'section' => 'billing',
+ 'description' => 'Template file for cancellation emails.',
+ 'type' => 'textarea',
+ },
+
+ {
+ 'key' => 'cancelsubject',
+ 'section' => 'billing',
+ 'description' => 'Subject line for cancellation emails.',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'emailcancel',
+ 'section' => 'billing',
+ 'description' => 'Enable emailing of cancellation notices.',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'require_cardname',
'section' => 'billing',
'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 294cb5c82..48b154d6e 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -8,6 +8,7 @@ use vars qw( $xaction $E_NoErr );
use vars qw( $bop_processor $bop_login $bop_password $bop_action @bop_options );
use vars qw( $ach_processor $ach_login $ach_password $ach_action @ach_options );
use vars qw( $invoice_lines @buf ); #yuck
+use vars qw( $quiet );
use Date::Format;
use Mail::Internet 1.44;
use Mail::Header;
@@ -842,7 +843,7 @@ sub realtime_bop {
my $perror = "$processor error, invnum #". $self->invnum. ': '.
$transaction->result_code. ": ". $transaction->error_message;
- if ( $conf->exists('emaildecline')
+ if ( !$quiet && $conf->exists('emaildecline')
&& grep { $_ ne 'POST' } $cust_main->invoicing_list
) {
my @templ = $conf->config('declinetemplate');
@@ -1211,7 +1212,7 @@ sub print_text {
=head1 VERSION
-$Id: cust_bill.pm,v 1.41.2.16 2002-12-17 21:31:22 ivan Exp $
+$Id: cust_bill.pm,v 1.41.2.17 2002-12-20 13:02:56 steve Exp $
=head1 BUGS
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 24b96c6e3..eb207d6d0 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -2,6 +2,7 @@ package FS::cust_pkg;
use strict;
use vars qw(@ISA);
+use vars qw( $quiet );
use FS::UID qw( getotaker dbh );
use FS::Record qw( qsearch qsearchs );
use FS::cust_svc;
@@ -20,6 +21,13 @@ use FS::svc_domain;
use FS::svc_www;
use FS::svc_forward;
+# need all this for sending cancel emails in sub cancel
+
+use FS::Conf;
+use Date::Format;
+use Mail::Internet 1.44;
+use Mail::Header;
+
@ISA = qw( FS::Record );
sub _cache {
@@ -291,7 +299,43 @@ sub cancel {
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
+ my $conf = new FS::Conf;
+
+ if ( !$quiet && $conf->exists('emailcancel')
+ && grep { $_ ne 'POST' } $self->cust_main->invoicing_list) {
+
+ my @invoicing_list = $self->cust_main->invoicing_list;
+
+ my $invoice_from = $conf->config('invoice_from');
+ my @print_text = map "$_\n", $conf->config('cancelmessage');
+ my $subject = $conf->config('cancelsubject');
+ my $smtpmachine = $conf->config('smtpmachine');
+
+ if ( grep { $_ ne 'POST' } @invoicing_list ) { #email invoice
+ #false laziness w/FS::cust_pay::delete & fs_signup_server && ::realtime_card
+ #$ENV{SMTPHOSTS} = $smtpmachine;
+ $ENV{MAILADDRESS} = $invoice_from;
+ my $header = new Mail::Header ( [
+ "From: $invoice_from",
+ "To: ". join(', ', grep { $_ ne 'POST' } @invoicing_list ),
+ "Sender: $invoice_from",
+ "Reply-To: $invoice_from",
+ "Date: ". time2str("%a, %d %b %Y %X %z", time),
+ "Subject: $subject",
+ ] );
+ my $message = new Mail::Internet (
+ 'Header' => $header,
+ 'Body' => [ @print_text ],
+ );
+ $!=0;
+ $message->smtpsend( Host => $smtpmachine )
+ or $message->smtpsend( Host => $smtpmachine, Debug => 1 );
+ #should this return an error?
+ }
+ }
+
''; #no errors
+
}
=item suspend
diff --git a/fs_selfservice/freeside-selfservice-server b/fs_selfservice/freeside-selfservice-server
index e55ca4984..264cbc56d 100644
--- a/fs_selfservice/freeside-selfservice-server
+++ b/fs_selfservice/freeside-selfservice-server
@@ -19,6 +19,10 @@ use Net::SSH qw(sshopen2);
use FS::UID qw(adminsuidsetup forksuidsetup);
use FS::ClientAPI;
+use FS::Conf;
+use FS::cust_bill;
+use FS::cust_pkg;
+
$Debug = 2; # >= 2 will log packet contents, including potentially compromising
# information
@@ -33,6 +37,13 @@ my $pid_file = "/var/run/freeside-selfservice-server.$user.pid";
&init($user);
+my $conf = new FS::Conf;
+
+if ($conf->exists('selfservice_server-quiet')) {
+ $FS::cust_bill::quiet = 1;
+ $FS::cust_pkg::quiet = 1;
+}
+
my $clientd = "/usr/local/sbin/freeside-selfservice-clientd"; #better name?
my $warnkids=0;