RT#25563: Better handling of commissions which do not have rates configured
[freeside.git] / FS / FS / part_event / Action / bill_sales_credit.pm
index 3193a81..ab69375 100644 (file)
@@ -38,6 +38,7 @@ sub do_action {
                                          pkgnum => { op => '>', value => '0' }
                                        });
 
+  my $warning = '';
   foreach my $cust_bill_pkg (@items) {
     my $pkgnum = $cust_bill_pkg->pkgnum;
     my $cust_pkg = $pkgnum_pkg{$pkgnum} ||= $cust_bill_pkg->cust_pkg;
@@ -50,7 +51,7 @@ sub do_action {
 
     next if !$sales; #no sales person, no credit
 
-    my $amount = $self->_calc_credit($cust_bill_pkg, $sales);
+    my $amount = $self->_calc_credit($cust_bill_pkg, $sales, \$warning);
 
     if ($amount > 0) {
       $salesnum_amount{$salesnum} ||= 0;
@@ -86,6 +87,8 @@ sub do_action {
       if $error;
   } # foreach $salesnum
 
+  return $warning;
+
 }
 
 1;