fix payment application with term discounts, #5318
[freeside.git] / FS / FS / cust_pay.pm
index 71bc707..2d7c6dd 100644 (file)
@@ -204,7 +204,7 @@ sub insert {
       }
       my @pkgs = $cust_main->_discount_pkgs_and_bill;
       my $cust_bill = shift(@pkgs);
-      @pkgs = &FS::cust_main::Billing::_discountable_pkgs_at_term($months, @pkgs);
+      @pkgs = &FS::cust_main::Billing_Discount::_discountable_pkgs_at_term($months, @pkgs);
       $_->bill($_->last_bill) foreach @pkgs;
       $error = $cust_main->bill( 
         'recurring_only' => 1,
@@ -551,7 +551,11 @@ sub send_receipt {
     my $msgnum = $conf->config('payment_receipt_msgnum', $cust_main->agentnum);
     if ( $msgnum ) {
       my $msg_template = FS::msg_template->by_key($msgnum);
-      $error = $msg_template->send('cust_main'=> $cust_main, 'object'=> $self);
+      $error = $msg_template->send(
+        'cust_main'   => $cust_main,
+        'object'      => $self,
+        'from_config' => 'payment_receipt_from',
+      );
 
     } elsif ( $conf->exists('payment_receipt_email') ) {