[Rt-commit] [rtir] 01/01: update accordingly for the core SLA in RT 4.4.

? sunnavy sunnavy at bestpractical.com
Tue Oct 13 13:49:06 EDT 2015


This is an automated email from the git hooks/post-receive script.

sunnavy pushed a commit to branch 3.4/sla-update
in repository rtir.

commit 3c5860362d13ed4a9886585fd43657574de5dca8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 14 01:45:37 2015 +0800

    update accordingly for the core SLA in RT 4.4.
---
 bin/add_constituency.in         | 12 +++++++++++-
 docs/AdministrationTutorial.pod | 11 +++++------
 etc/initialdata                 |  3 ++-
 etc/upgrade/3.3.2/content       | 41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/bin/add_constituency.in b/bin/add_constituency.in
index 31c97e1..788b43d 100755
--- a/bin/add_constituency.in
+++ b/bin/add_constituency.in
@@ -482,7 +482,8 @@ sub create_or_load_queue {
             Name              => $name,
             CommentAddress    => $opt{'comment'},
             CorrespondAddress => $opt{'correspond'},
-            Lifecycle         => $lifecycle
+            Lifecycle         => $lifecycle,
+            SLADisabled       => $basequeue->SLADisabled,
         );
         debug "Creating new queue '$name': $msg\n";
         debug "\tcomment address:\t$opt{'comment'}" if $opt{'comment'};
@@ -504,6 +505,15 @@ sub create_or_load_queue {
                 debug "\tnew $type address: " . $opt{ lc $type };
             }
         }
+        if ( $queue->SLADisabled != $basequeue->SLADisabled ) {
+            my ( $status, $msg ) = $queue->SetSLADisabled( $basequeue->SLADisabled );
+            if ($status) {
+                debug "\tSLADisabled: " . $queue->SLADisabled;
+            }
+            else {
+                print STDERR "Couldn't set SLADisabled of '$name' queue: $msg\n";
+            }
+        }
     }
 
     my $basecfs = RT::CustomFields->new( RT->SystemUser );
diff --git a/docs/AdministrationTutorial.pod b/docs/AdministrationTutorial.pod
index b8c84fb..0858b64 100644
--- a/docs/AdministrationTutorial.pod
+++ b/docs/AdministrationTutorial.pod
@@ -389,11 +389,10 @@ L<RT::Extension::SLA> was prototyped on it, but vastly improved. In RTIR 3.0
 we removed the SLA implementation in the core of RTIR that was in conflict
 with the extension.
 
-If you install and configure L<RT::Extension::SLA> do not apply it to
-the Incidents queue.  You will encounter a race condition between the
-extension and the RTIR scrips that synchronize due dates between
-an incident and its most due active child.  If you need to manage
-incident due dates using the SLA extension, you can disable the RTIR
-scrips that manage due dates on the Incidents queue.
+RT 4.4 has cored L<RT::Extension::SLA>, please disable SLA on the Incidents
+queues.  You will encounter a race condition between the core SLA and the RTIR
+scrips that synchronize due dates between an incident and its most due active
+child.  If you need to manage incident due dates using the core SLA, you can
+disable the RTIR scrips that manage due dates on the Incidents queues.
 
 =cut
diff --git a/etc/initialdata b/etc/initialdata
index dc3b757..b09c634 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -17,7 +17,8 @@
             $_ eq 'incidents'
             ? 50
             : 0
-        )
+        ),
+        SLADisabled => ( $_ eq 'incidents' ? 1 : 0 ),
     }
 } RT::IR->Lifecycles;
 
diff --git a/etc/upgrade/3.3.2/content b/etc/upgrade/3.3.2/content
new file mode 100644
index 0000000..894d2d3
--- /dev/null
+++ b/etc/upgrade/3.3.2/content
@@ -0,0 +1,41 @@
+use strict;
+use warnings;
+
+our @Initial = (
+    sub {
+        my $action = RT::ScripAction->new(RT->SystemUser);
+        $action->Load('RTIR Set Incident Due');
+        if ( $action->id ) {
+            my $scrips = RT::Scrips->new(RT->SystemUser);
+            $scrips->Limit( FIELD => 'ScripAction', VALUE => $action->id );
+            return unless $scrips->Count;
+            my $report_queues = RT::Queues->new(RT->SystemUser);
+            $report_queues->Limit( FIELD => 'Lifecycle', VALUE => RT::IR->lifecycle_report );
+            return unless $report_queues->Count;
+            my @report_queues = @{$report_queues->ItemsArrayRef};
+            my $incident_queues = RT::Queues->new(RT->SystemUser);
+            $incident_queues->Limit( FIELD => 'Lifecycle', VALUE => RT::IR->lifecycle_incident );
+            return unless $incident_queues->Count;
+            my @incident_queues = @{$incident_queues->ItemsArrayRef};
+            my %queue_map;
+            for my $incident_queue( @incident_queues ) {
+                $queue_map{$incident_queue->FirstCustomFieldValue('RTIR Constituency') || '' } = $incident_queue;
+            }
+
+            while ( my $scrip = $scrips->Next ) {
+                for my $report_queue ( @report_queues ) {
+                    if ( $scrip->IsAdded($report_queue->id) ) {
+                        my $incident_queue =
+                            $queue_map{$report_queue->FirstCustomFieldValue('RTIR Constituency') || ''};
+                        if ( $incident_queue && !$incident_queue->SLADisabled ) {
+                            my ($ret, $msg) = $incident_queue->SetSLADisabled(1);
+                            unless ( $ret ) {
+                                RT->Logger->error("Couldn't disable core SLA for queue #" . $incident_queue->id . ": $msg");
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    },
+);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list