[Rt-commit] rt branch, 4.4/fix-sla-start-changes, created. rt-4.4.1-332-gb4f970d

Dave Goehrig dave at bestpractical.com
Wed Apr 12 09:35:17 EDT 2017


The branch, 4.4/fix-sla-start-changes has been created
        at  b4f970d8ffbbeb39a8596ec762f00e1a459d05dd (commit)

- Log -----------------------------------------------------------------
commit b4f970d8ffbbeb39a8596ec762f00e1a459d05dd
Author: Dave Goehrig <dave at bestpractical.com>
Date:   Wed Apr 12 09:24:42 2017 -0400

    Fix changing start time based on SLA
    
    When you have multiple SLA levels with different start
    times, the SLA's start time was not changing.  This patch
    removes the check for the ticket's Starts field being set,
    but has the downside of the setting of start time will
    happen on most transactions.
    
    Fixes: I#32028

diff --git a/lib/RT/Condition/SLA_RequireStartsSet.pm b/lib/RT/Condition/SLA_RequireStartsSet.pm
index 260455a..698e297 100644
--- a/lib/RT/Condition/SLA_RequireStartsSet.pm
+++ b/lib/RT/Condition/SLA_RequireStartsSet.pm
@@ -65,7 +65,6 @@ Applies if Starts date is not set for the ticket.
 
 sub IsApplicable {
     my $self = shift;
-    return 0 if $self->TicketObj->StartsObj->Unix > 0;
     return 0 if $self->TicketObj->QueueObj->SLADisabled;
     return 0 unless $self->TicketObj->SLA;
     return 1;
diff --git a/t/sla/starts.t b/t/sla/starts.t
index b180ff0..cde5672 100644
--- a/t/sla/starts.t
+++ b/t/sla/starts.t
@@ -78,4 +78,39 @@ diag 'check Starts date with StartImmediately enabled' if $ENV{'TEST_VERBOSE'};
     is $starts, $ticket->CreatedObj->Unix, 'Starts is correct';
 }
 
+
+diag 'check changing start time' if $ENV{'TEST_VERBOSE'};
+{
+    RT->Config->Set(ServiceAgreements => (
+        Default => 'standard',
+        Levels  => {
+            'standard' => {
+                Starts => 60,
+                Response => 2 * 60,
+                Resolve  => 7 * 60 * 24,
+            },
+            'nonstandard' => {
+                Starts => 2 * 60,
+                Response => 3 * 60,
+                Resolve => 4 * 60
+            }
+        },
+    ));
+
+    my $ticket = RT::Ticket->new($RT::SystemUser);
+    my ($id) = $ticket->Create( Queue => 'General', Subject => 'test sla start time change');
+    ok $id, "Created ticket $id";
+    
+    my $starts = $ticket->StartsObj->Unix;
+    ok $starts > 0, 'Starts date is set';
+    
+    $ticket->SetSLA('nonstandard');
+    my $new_starts = $ticket->StartsObj->Unix;
+    is $new_starts - $starts, 3600, 'Starts time changed on SLA update';
+    
+    $ticket->SetSLA('standard');
+    my $reset_starts = $ticket->StartsObj->Unix;
+    is $reset_starts, $starts, 'Start date reset';
+}
+
 done_testing;

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


More information about the rt-commit mailing list