diff --git a/bin/add_constituency.in b/bin/add_constituency.in index 31c97e13..788b43d4 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 b8c84fb6..0858b64b 100644 --- a/docs/AdministrationTutorial.pod +++ b/docs/AdministrationTutorial.pod @@ -389,11 +389,10 @@ L 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 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, 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 dc3b7575..b09c634e 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 00000000..894d2d3b --- /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"); + } + } + } + } + } + } + }, +);