RT#14671: Usage for current day when billing outstanding usage (for cancelling custom...
authorJonathan Prykop <jonathan@freeside.biz>
Mon, 16 Feb 2015 21:30:37 +0000 (15:30 -0600)
committerJonathan Prykop <jonathan@freeside.biz>
Mon, 16 Feb 2015 21:30:37 +0000 (15:30 -0600)
FS/FS/cust_pkg.pm
FS/FS/part_pkg_link.pm

index 0cb6209..7678a02 100644 (file)
@@ -935,7 +935,11 @@ sub cancel {
   }
 
   foreach my $supp_pkg ( $self->supplemental_pkgs ) {
-    $error = $supp_pkg->cancel(%options, 'from_main' => 1);
+    if ($delay_cancel) {
+        $error = $supp_pkg->suspend(%options, 'from_main' => 1, 'reason' => undef);
+    } else {
+        $error = $supp_pkg->cancel(%options, 'from_main' => 1);
+    }
     if ( $error ) {
       $dbh->rollback if $oldAutoCommit;
       return "canceling supplemental pkg#".$supp_pkg->pkgnum.": $error";
index 2460e99..aee0131 100644 (file)
@@ -260,11 +260,6 @@ sub check {
                ") must be an integer multiple of main package period.";
       }
     }
-    if (( $src_pkg->option('delay_cancel',1) && !$dst_pkg->option('delay_cancel',1) ) ||
-        ( $dst_pkg->option('delay_cancel',1) && !$src_pkg->option('delay_cancel',1) )
-    ) {
-      return "Supplemental package must have same value as main package for automatic suspension on cancel.";
-    }
   }
 
   $self->SUPER::check;