invoice number on manual payment receipts, RT#26083
[freeside.git] / FS / FS / cust_pay.pm
index 0f643c9..a65520f 100644 (file)
@@ -616,11 +616,12 @@ sub send_receipt {
         'custnum' => $cust_main->custnum,
       };
       $error = $queue->insert(
-         FS::msg_template->by_key($msgnum)->prepare(
+        FS::msg_template->by_key($msgnum)->prepare(
           'cust_main'   => $cust_main,
           'object'      => $self,
           'from_config' => 'payment_receipt_from',
-        )
+        ),
+        'msgtype' => 'receipt', # override msg_template's default
       );
 
     } elsif ( $conf->exists('payment_receipt_email') ) {
@@ -654,6 +655,8 @@ sub send_receipt {
         '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?
@@ -663,6 +666,7 @@ sub send_receipt {
         '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),