summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-05-15 02:39:26 -0700
committerIvan Kohler <ivan@freeside.biz>2013-05-15 02:39:26 -0700
commitffe2da5352a459c39f8e9bd999e96a03c86324fb (patch)
treeeb764ad043073ab8ebfd62847a5877e17a11b14b /FS
parentcc9bdd96a6a3c70b87ef3ed1a9aa15bb0923d61c (diff)
queue all email receipts, RT#22731, RT#23023
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_pay.pm32
1 files changed, 22 insertions, 10 deletions
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 86fcf9b4d..f6954a4bc 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -9,7 +9,6 @@ use vars qw( $DEBUG $me $conf @encrypted_fields
use Date::Format;
use Business::CreditCard;
use Text::Template;
-use FS::Misc qw( send_email );
use FS::Record qw( dbh qsearch qsearchs );
use FS::CurrentUser;
use FS::payby;
@@ -593,11 +592,18 @@ sub send_receipt {
{
my $msgnum = $conf->config('payment_receipt_msgnum', $cust_main->agentnum);
if ( $msgnum ) {
- my $msg_template = FS::msg_template->by_key($msgnum);
- $error = $msg_template->send(
- 'cust_main' => $cust_main,
- 'object' => $self,
- 'from_config' => 'payment_receipt_from',
+
+ my $queue = new FS::queue {
+ 'job' => 'FS::Misc::process_send_email',
+ 'paynum' => $self->paynum,
+ 'custnum' => $cust_main->custnum,
+ };
+ $error = $queue->insert(
+ FS::msg_template->by_key($msgnum)->prepare(
+ 'cust_main' => $cust_main,
+ 'object' => $self,
+ 'from_config' => 'payment_receipt_from',
+ )
);
} elsif ( $conf->exists('payment_receipt_email') ) {
@@ -636,7 +642,12 @@ sub send_receipt {
#setup date, other things?
}
- $error = send_email(
+ my $queue = new FS::queue {
+ 'job' => 'FS::Misc::process_send_generated_email',
+ 'paynum' => $self->paynum,
+ 'custnum' => $cust_main->custnum,
+ };
+ $error = $queue->insert(
'from' => $conf->config('invoice_from', $cust_main->agentnum),
#invoice_from??? well as good as any
'to' => \@invoicing_list,
@@ -653,8 +664,9 @@ sub send_receipt {
} elsif ( ! $cust_main->invoice_noemail ) { #not manual
my $queue = new FS::queue {
- 'paynum' => $self->paynum,
- 'job' => 'FS::cust_bill::queueable_email',
+ 'job' => 'FS::cust_bill::queueable_email',
+ 'paynum' => $self->paynum,
+ 'custnum' => $cust_main->custnum,
};
$error = $queue->insert(
@@ -666,7 +678,7 @@ sub send_receipt {
}
- warn "send_receipt: $error\n" if $error;
+ warn "send_receipt: $error\n" if $error;
}
=item cust_bill_pay