Skip to content

Commit

Permalink
Merge branch '3.4/sla-update' into 3.4/reimplement-constituencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sartak committed Oct 19, 2015
2 parents 68b8207 + cf40565 commit b10018f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
12 changes: 11 additions & 1 deletion bin/add_constituency.in
Original file line number Diff line number Diff line change
Expand Up @@ -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'};
Expand All @@ -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 );
Expand Down
11 changes: 5 additions & 6 deletions docs/AdministrationTutorial.pod
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion etc/initialdata
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
$_ eq 'incidents'
? 50
: 0
)
),
SLADisabled => ( $_ eq 'incidents' ? 1 : 0 ),
}
} RT::IR->Lifecycles;

Expand Down
41 changes: 41 additions & 0 deletions etc/upgrade/3.3.2/content
Original file line number Diff line number Diff line change
@@ -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");
}
}
}
}
}
}
},
);

0 comments on commit b10018f

Please sign in to comment.