ignore setup+start date on upgrade, RT#25516, RT#21464
authorIvan Kohler <ivan@freeside.biz>
Sun, 20 Oct 2013 06:24:20 +0000 (23:24 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sun, 20 Oct 2013 06:24:20 +0000 (23:24 -0700)
FS/FS/Upgrade.pm
FS/FS/cust_pkg.pm

index 037c4b3..a7fe99f 100644 (file)
@@ -132,6 +132,9 @@ sub upgrade {
   local $FS::UID::AutoCommit = 0;
   local $FS::UID::AutoCommit = 0;
 
+  local $FS::cust_pkg::upgrade = 1; #go away after setup+start dates cleaned up for old customers
+
+
   foreach my $table ( keys %$data ) {
 
     my $class = "FS::$table";
index 009c81e..face10a 100644 (file)
@@ -4,7 +4,7 @@ use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::Sales_Mixin
              FS::m2m_Common FS::option_Common );
 
 use strict;
-use vars qw($disable_agentcheck $DEBUG $me);
+use vars qw( $disable_agentcheck $DEBUG $me $upgrade );
 use Carp qw(cluck);
 use Scalar::Util qw( blessed );
 use List::Util qw(min max);
@@ -54,6 +54,8 @@ $me = '[FS::cust_pkg]';
 
 $disable_agentcheck = 0;
 
+$upgrade = 0; #go away after setup+start dates cleaned up for old customers
+
 sub _cache {
   my $self = shift;
   my ( $hashref, $cache ) = @_;
@@ -656,7 +658,7 @@ sub check {
   return $error if $error;
 
   return "A package with both start date (future start) and setup date (already started) will never bill"
-    if $self->start_date && $self->setup;
+    if $self->start_date && $self->setup && ! $upgrade;
 
   return "A future unsuspend date can only be set for a package with a suspend date"
     if $self->resume and !$self->susp and !$self->adjourn;