RT# 82137 - added processing fee template substitution.
authorChristopher Burger <burgerc@freeside.biz>
Tue, 25 Jun 2019 14:55:00 +0000 (10:55 -0400)
committerChristopher Burger <burgerc@freeside.biz>
Tue, 25 Jun 2019 17:00:41 +0000 (13:00 -0400)
Conflicts:
httemplate/edit/msg_template/email.html
httemplate/elements/tr-amount_fee.html

httemplate/edit/msg_template.html
httemplate/elements/tr-amount_fee.html

index 17e9966..1fa94ab 100644 (file)
@@ -291,6 +291,7 @@ my %substitutions = (
   'cust_pay'  => [
     '$paynum'         => 'Payment#',
     '$paid'           => 'Amount',
+    '$processing_fee' => 'Processing fee',
     '$payby'          => 'Payment method',
     '$date'           => 'Payment date',
     '$payinfo'        => 'Card/account# (masked)',
@@ -365,6 +366,7 @@ Substitutions: '
 <BR>Enclose substitutions and other Perl expressions in braces:
 <BR>{ $name } = ExampleCo (Smith, John)
 <BR>{ time2str("%D", time) } = '.time2str("%D", time).'
+<BR>{ "processing fee of $processing_fee" if $processing_fee; } = Will display text if there is a processing fee
 </FONT></TD>
 ';
 
index 7797f6c..e90d364 100644 (file)
@@ -123,7 +123,9 @@ if ( $opt{'process-pkgpart'}
 
 }
 
-my $amount = $opt{'amount'};
+$processing_fee = $opt{'processing_fee'} if $opt{'processing_fee'} > 0;
+
+my $amount = $opt{'amount'} ? $opt{'amount'} : "0.00";
 if ( $amount > 0 ) {
   $amount += $fee
     if $fee && $fee_display eq 'subtract';
@@ -135,8 +137,6 @@ if ( $amount > 0 ) {
   $amount += $opt{'surcharge_flatfee'}
     if $opt{'surcharge_flatfee'} > 0;
 
-  $processing_fee = $opt{'processing_fee'} if $opt{'processing_fee'} > 0;
-
   $amount += $processing_fee; ## needed if processing fee is checked on default.
 
   $amount = sprintf("%.2f", $amount);