take the package-def defined action here, like freeside-prepaidd
[freeside.git] / FS / FS / Cron / bill.pm
index 774bf30..4d77fd0 100644 (file)
@@ -94,7 +94,8 @@ END
            }
            $cust_main->ncancelled_pkgs
     ) {
-      my $error = $cust_pkg->suspend;
+      my $action = $cust_pkg->part_pkg->option('recur_action') || 'suspend';
+      my $error = $cust_pkg->$action();
       warn "Error suspending package ". $cust_pkg->pkgnum.
            " for custnum ". $cust_main->custnum.
            ": $error"
@@ -106,8 +107,7 @@ END
                                 );
     warn "Error billing, custnum ". $cust_main->custnum. ": $error" if $error;
   
-    $cust_main->apply_payments;
-    $cust_main->apply_credits;
+    $cust_main->apply_payments_and_credits;
   
     $error = $cust_main->collect( 'invoice_time' => $time,
                                   'freq'         => $opt{'freq'},