#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'},
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,
};
$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
);