set the suspension date before calling service suspensions, fix RADIUS groups suspens...
authorivan <ivan>
Tue, 18 Oct 2011 19:25:39 +0000 (19:25 +0000)
committerivan <ivan>
Tue, 18 Oct 2011 19:25:39 +0000 (19:25 +0000)
FS/FS/cust_pkg.pm

index 27b8409..b1a4d03 100644 (file)
@@ -1000,6 +1000,19 @@ sub suspend {
     }
   }
 
     }
   }
 
+  my %hash = $self->hash;
+  if ( $date ) {
+    $hash{'adjourn'} = $date;
+  } else {
+    $hash{'susp'} = $suspend_time;
+  }
+  my $new = new FS::cust_pkg ( \%hash );
+  $error = $new->replace( $self, options => { $self->options } );
+  if ( $error ) {
+    $dbh->rollback if $oldAutoCommit;
+    return $error;
+  }
+
   unless ( $date ) {
 
     my @labels = ();
   unless ( $date ) {
 
     my @labels = ();
@@ -1055,19 +1068,6 @@ sub suspend {
 
   }
 
 
   }
 
-  my %hash = $self->hash;
-  if ( $date ) {
-    $hash{'adjourn'} = $date;
-  } else {
-    $hash{'susp'} = $suspend_time;
-  }
-  my $new = new FS::cust_pkg ( \%hash );
-  $error = $new->replace( $self, options => { $self->options } );
-  if ( $error ) {
-    $dbh->rollback if $oldAutoCommit;
-    return $error;
-  }
-
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
 
   ''; #no errors
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
 
   ''; #no errors