safety guard for ScheduledResolve action
authorMark Wells <mark@freeside.biz>
Wed, 21 Aug 2013 21:28:06 +0000 (14:28 -0700)
committerMark Wells <mark@freeside.biz>
Wed, 21 Aug 2013 21:28:06 +0000 (14:28 -0700)
rt/lib/RT/Action/ScheduledResolve.pm

index 6b323cb..dafa91a 100644 (file)
@@ -20,7 +20,9 @@ sub Prepare {
       'deleted'
     ); # don't resolve from any of these states.
     my $time = $self->TicketObj->WillResolveObj->Unix;
-    return ( $time > 0 and $time < time() );
+    # resolve if the WillResolve date is set, and in the past,
+    # and less than a year old
+    return ( $time > 0 and $time < time() and (time() - $time) < 31536000 );
 }
 
 sub Commit {