rt 4.0.23
[freeside.git] / rt / lib / RT / Action / EscalatePriority.pm
index 86e3e64..04aa7ed 100644 (file)
@@ -2,7 +2,7 @@
 #
 # COPYRIGHT:
 #
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
 #                                          <sales@bestpractical.com>
 #
 # (Except where explicitly superseded by other copyright notices)
@@ -67,6 +67,9 @@ to final priority.
 In this way, priority is either increased or decreased toward the final priority
 as the ticket heads toward its due date.
 
+Alternately, if you don't set a due date, the Priority will be incremented by 1
+until it reaches the Final Priority.  If a ticket without a due date has a Priority
+greater than Final Priority, it will be decremented by 1.
 
 =cut
 
@@ -75,20 +78,18 @@ package RT::Action::EscalatePriority;
 use base 'RT::Action';
 
 use strict;
+use warnings;
 
 #Do what we need to do and send it out.
 
 #What does this type of Action does
 
-# {{{ sub Describe 
 sub Describe  {
   my $self = shift;
   return (ref $self . " will move a ticket's priority toward its final priority.");
 }
-# }}}
        
 
-# {{{ sub Prepare 
 sub Prepare  {
     my $self = shift;
     
@@ -121,7 +122,12 @@ sub Prepare  {
 
     # we've got a due date. now there are other things we should do
     else { 
-       my $diff_in_seconds = $due->Diff(time());    
+        my $arg = $self->Argument || '';
+        my $now = time();
+        if ( $arg =~ /CurrentTime:\s*(\d+)/i ) {
+            $now = $1;
+        } 
+       my $diff_in_seconds = $due->Diff($now);    
        my $diff_in_days = int( $diff_in_seconds / 86400);    
        
        #if we haven't hit the due date yet
@@ -147,7 +153,6 @@ sub Prepare  {
     }
     return 1;
 }
-# }}}
 
 sub Commit {
     my $self = shift;
@@ -158,9 +163,6 @@ sub Commit {
    }
 }
 
-eval "require RT::Action::EscalatePriority_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/EscalatePriority_Vendor.pm});
-eval "require RT::Action::EscalatePriority_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/EscalatePriority_Local.pm});
+RT::Base->_ImportOverlays();
 
 1;