[Bps-public-commit] r10997 - RT-Action-LinearEscalate/lib/RT/Action

ruz at bestpractical.com ruz at bestpractical.com
Tue Mar 4 16:36:38 EST 2008


Author: ruz
Date: Tue Mar  4 16:36:29 2008
New Revision: 10997

Modified:
   RT-Action-LinearEscalate/lib/RT/Action/LinearEscalate.pm

Log:
* add support for negative directions

Modified: RT-Action-LinearEscalate/lib/RT/Action/LinearEscalate.pm
==============================================================================
--- RT-Action-LinearEscalate/lib/RT/Action/LinearEscalate.pm	(original)
+++ RT-Action-LinearEscalate/lib/RT/Action/LinearEscalate.pm	Tue Mar  4 16:36:29 2008
@@ -114,17 +114,25 @@
     my $self = shift;
 
     my $ticket = $self->TicketObj;
-    if ( $ticket->Priority >= $ticket->FinalPriority ) {
+
+    # If we don't have a due date, get out
+    my $due = $ticket->DueObj->Unix;
+    return 1 unless $due > 0;
+
+    my $priority_range = $ticket->FinalPriority - $ticket->InitialPriority;
+    # equal or undefined
+    return 1 unless $priority_range;
+
+    if ( $ticket->Priority >= $ticket->FinalPriority && $priority_range > 0 ) {
         # no update necessary.
         return 1;
     }
+    elsif ( $ticket->Priority <= $ticket->FinalPriority && $priority_range < 0 ) {
+        return 1;
+    }
 
     # TODO: compute the number of business days until the ticket is due
 
-    # If we don't have a due date, get out
-    my $due = $ticket->DueObj->Unix;
-    return 1 unless $due > 0;
-
     # now we know we have a due date. for every day that passes,
     # increment priority according to the formula
 



More information about the Bps-public-commit mailing list