From 2745cc5da9e4ef3ce98f71740b3f692de28540d7 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sun, 27 Apr 2014 15:38:45 -0700 Subject: [PATCH] invoice # in payment receipts, RT#26083 --- FS/FS/cust_bill_pay_pkg.pm | 6 +++++- FS/FS/cust_pay.pm | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/FS/FS/cust_bill_pay_pkg.pm b/FS/FS/cust_bill_pay_pkg.pm index 0a17469e5..efd5138a1 100644 --- a/FS/FS/cust_bill_pay_pkg.pm +++ b/FS/FS/cust_bill_pay_pkg.pm @@ -97,7 +97,11 @@ sub insert { #payment receipt my $conf = new FS::Conf; - my $trigger = $conf->config('payment_receipt-trigger') || 'cust_pay'; + my $trigger = + $conf->config('payment_receipt-trigger', + $self->cust_bill_pay->cust_bill->cust_main->agentnum, + ) + || 'cust_pay'; if ( $trigger eq 'cust_bill_pay_pkg' ) { my $error = $self->send_receipt( 'manual' => $options{'manual'}, diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index a65520f6b..ca681e617 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -610,6 +610,9 @@ sub send_receipt { my $msgnum = $conf->config('payment_receipt_msgnum', $cust_main->agentnum); if ( $msgnum ) { + my %substitutions = (); + $substitutions{invnum} = $opt->{cust_bill}->invnum if $opt->{cust_bill}; + my $queue = new FS::queue { 'job' => 'FS::Misc::process_send_email', 'paynum' => $self->paynum, @@ -617,9 +620,10 @@ sub send_receipt { }; $error = $queue->insert( FS::msg_template->by_key($msgnum)->prepare( - 'cust_main' => $cust_main, - 'object' => $self, - 'from_config' => 'payment_receipt_from', + 'cust_main' => $cust_main, + 'object' => $self, + 'from_config' => 'payment_receipt_from', + 'substitutions' => \%substitutions, ), 'msgtype' => 'receipt', # override msg_template's default ); -- 2.11.0