RT# 82137 - Added ability for processing fee to be pain on seperate invoice.
[freeside.git] / FS / FS / cust_pay.pm
index 61e5ea3..3f6b8e8 100644 (file)
@@ -381,6 +381,8 @@ sub insert {
 
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
 
+  $self->{'processing_fee'} = $options{'processing-fee'};
+
   #payment receipt
   my $trigger = $conf->config('payment_receipt-trigger', 
                               $self->cust_main->agentnum) || 'cust_pay';
@@ -673,7 +675,7 @@ sub send_receipt {
         'cust_main'      => $cust_main,
         'cust_bill'      => $opt->{cust_bill},
         'cust_pkg'       => $opt->{cust_pkg},
-        'invoicing_list' => @invoicing_list,
+        'invoicing_list' => \@invoicing_list,
         'msgnum'         => $conf->config('payment_receipt_msgnum', $cust_main->agentnum)
     );
 
@@ -710,9 +712,6 @@ sub send_receipt {
 
       $error = $queue->insert(%opt);
     }
-
-
-
   }
 
   warn "send_receipt: $error\n" if $error;
@@ -725,7 +724,7 @@ $error = $self->send_message_receipt(
         'cust_main'      => $cust_main,
         'cust_bill'      => $opt->{cust_bill},
         'cust_pkg'       => $opt->{cust_pkg},
-        'invoicing_list' => @invoicing_list,
+        'invoicing_list' => \@invoicing_list,
         'msgnum'         => $conf->config('payment_receipt_msgnum', $cust_main->agentnum)
       );
 
@@ -736,7 +735,7 @@ sub send_message_receipt {
   my $cust_main      = $opt{'cust_main'};
   my $cust_bill      = $opt{'cust_bill'};
   my $cust_pkg       = $opt{'cust_pkg'};
-  my @invoicing_list = $opt{'invoicing_list'};
+  my @invoicing_list = ref($opt{'invoicing_list'}) ? @{ $opt{'invoicing_list'} } : ( $opt{'invoicing_list'} );
   my $msgnum         = $opt{'msgnum'};
   my $error = '';
 
@@ -744,6 +743,8 @@ sub send_message_receipt {
 
       my %substitutions = ();
       $substitutions{invnum} = $cust_bill->invnum if $cust_bill;
+      $substitutions{'processing_fee'} = $self->{'processing_fee'};
+
 
       my $msg_template = qsearchs('msg_template',{ msgnum => $msgnum});
       unless ($msg_template) {