[Bps-public-commit] RT-Extension-SLA branch, master, updated. 1.04-1-g8f611d9

? sunnavy sunnavy at bestpractical.com
Wed Jul 1 11:09:35 EDT 2015


The branch, master has been updated
       via  8f611d9fed3fd3afbb237b5cf75c361743147e77 (commit)
      from  219ef4917e4ac31537f4afbb43e1bf9082d63f75 (commit)

Summary of changes:
 README                      | 12 +++++++++++-
 lib/RT/Action/SLA_SetDue.pm | 23 +++++++++++++++++++++++
 lib/RT/Extension/SLA.pm     | 12 ++++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 8f611d9fed3fd3afbb237b5cf75c361743147e77
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jul 1 23:01:52 2015 +0800

    new option RecalculateDueOnIgnoredStatusChange
    
    if it's enabled, we will calculate the Response/KeepInLoop due date from not
    just last reply, but also last ignored status change, depending on which is
    the later one.

diff --git a/README b/README
index bd3c29b..e5b10ef 100644
--- a/README
+++ b/README
@@ -263,7 +263,17 @@ CONFIGURATION
     result of RT's auto-open on reply scrip, therefore ensuring there's a
     new reply to calculate Due from. The overall effect is that ignored
     statuses don't let the Due date drift arbitrarily, which could wreak
-    havoc on your SLA performance.
+    havoc on your SLA performance. The option
+    RecalculateDueOnIgnoredStatusChange could get around the "probably be
+    overdue" issue by considering the last ignored status date too. e.g.
+
+        'level x' => {
+            KeepInLoop => {
+                BusinessMinutes => 60,
+                RecalculateDueOnIgnoredStatusChange => 1,
+                IgnoreOnStatuses => ['stalled'],
+            },
+        },
 
   Configuring business hours
     In the config you can set one or more work schedules. Use the following
diff --git a/lib/RT/Action/SLA_SetDue.pm b/lib/RT/Action/SLA_SetDue.pm
index 4f3ed30..f837e86 100644
--- a/lib/RT/Action/SLA_SetDue.pm
+++ b/lib/RT/Action/SLA_SetDue.pm
@@ -43,6 +43,16 @@ sub Commit {
         .' to ticket #'. $ticket->id .' is txn #'. $last_reply->id
     );
 
+    my $meta =
+        $RT::ServiceAgreements{ 'Levels' }{ $level }
+      ? $RT::ServiceAgreements{ 'Levels' }{ $level }{ $is_outside ? 'Response' : 'KeepInLoop' }
+      : undef;
+    if ( $meta && $meta->{IgnoreOnStatuses} && $meta->{RecalculateDueOnIgnoredStatusChange} ) {
+        my $last_ignored_status_txn = $self->LastIgnoredStatusAct(@{$meta->{IgnoreOnStatuses}});
+        $last_reply = $last_ignored_status_txn
+          if $last_ignored_status_txn && $last_reply->Created lt $last_ignored_status_txn->Created;
+    }
+
     my $response_due = $self->Due(
         Ticket => $ticket,
         Level => $level,
@@ -109,4 +119,17 @@ sub LastEffectiveAct {
     return ($res, 1);
 }
 
+sub LastIgnoredStatusAct {
+    my $self = shift;
+    my @statuses = @_;
+    my $txns = $self->TicketObj->Transactions;
+    $txns->Limit( FIELD => 'FIELD', VALUE => 'Status' );
+    $txns->Limit( FIELD => 'OldValue', OPERATOR => 'IN', VALUE => \@statuses );
+    $txns->OrderByCols(
+        { FIELD => 'Created', ORDER => 'DESC' },
+        { FIELD => 'id', ORDER => 'DESC' },
+    );
+    return $txns->First;
+}
+
 1;
diff --git a/lib/RT/Extension/SLA.pm b/lib/RT/Extension/SLA.pm
index 1b375e8..b386cce 100644
--- a/lib/RT/Extension/SLA.pm
+++ b/lib/RT/Extension/SLA.pm
@@ -305,6 +305,18 @@ out of stalled-like statuses is often the result of RT's auto-open on reply
 scrip, therefore ensuring there's a new reply to calculate Due from.  The
 overall effect is that ignored statuses don't let the Due date drift
 arbitrarily, which could wreak havoc on your SLA performance.
+The option C<RecalculateDueOnIgnoredStatusChange> could get around the
+"probably be overdue" issue by considering the last ignored status date too.
+e.g.
+
+    'level x' => {
+        KeepInLoop => {
+            BusinessMinutes => 60,
+            RecalculateDueOnIgnoredStatusChange => 1,
+            IgnoreOnStatuses => ['stalled'],
+        },
+    },
+
 
 =head2 Configuring business hours
 

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list