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,
'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',
- )
+ FS::msg_template->by_key($msgnum)->prepare(
+ 'cust_main' => $cust_main,
+ 'object' => $self,
+ 'from_config' => 'payment_receipt_from',
+ 'substitutions' => \%substitutions,
+ ),
+ 'msgtype' => 'receipt', # override msg_template's default
);
} elsif ( $conf->exists('payment_receipt_email') ) {
'company_name' => $conf->config('company_name', $cust_main->agentnum),
);
+ $fill_in{'invnum'} = $opt->{cust_bill}->invnum if $opt->{cust_bill};
+
if ( $opt->{'cust_pkg'} ) {
$fill_in{'pkg'} = $opt->{'cust_pkg'}->part_pkg->pkg;
#setup date, other things?
'job' => 'FS::Misc::process_send_generated_email',
'paynum' => $self->paynum,
'custnum' => $cust_main->custnum,
+ 'msgtype' => 'receipt',
};
$error = $queue->insert(
'from' => $conf->config('invoice_from', $cust_main->agentnum),