[Rt-commit] [rtir] 01/01: Disable and unapply the SLA CF
Kevin Falcone
falcone at bestpractical.com
Thu Sep 25 17:01:42 EDT 2014
This is an automated email from the git hooks/post-receive script.
falcone pushed a commit to branch 3.0/disable-acl-cf
in repository rtir.
commit a1b70753aee4ded2aa1c1f11819d4bf6236acce8
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Sep 25 16:47:45 2014 -0400
Disable and unapply the SLA CF
Because we didn't do this, you could end up with two SLA fields when
installing RT::Extension::SLA. If you noticed this and disabled the one
on the Incident Reports queue, RT::Extension::SLA would still find and
prefer that disabled CF before finding the global CF. We disable and
unapply the field to avoid this.
We cannot safely do this for users who have already upgraded (or
installed) RTIR 3 because it could damage a working RT::Extension::SLA
installation.
---
docs/UPGRADING-3.0 | 6 ++++++
etc/upgrade/2.9.0/content | 24 ++++++++++++++++++++++++
t/upgrade/2.6.0-to-2.9.0.t | 12 +++++++++++-
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/docs/UPGRADING-3.0 b/docs/UPGRADING-3.0
index 0466c53..ff15ebb 100644
--- a/docs/UPGRADING-3.0
+++ b/docs/UPGRADING-3.0
@@ -154,6 +154,12 @@ installed. You should then test with the new SLA configurations in
a dev environment to verify that due dates are being properly set
for all relevant actions (create, respond, resolve, etc.).
+Starting in 3.0.3, RTIR also disables and unapplies the SLA Custom Field since it can
+conflict with the field provided by L<RT::Extension::SLA> and cause SLAs
+not to apply properly. This change is only automated for users coming to
+3.0 or later for the first time. If you previously upgraded to 3.0.x and
+then to 3.0.3, your SLA field will not be changed.
+
=head2 Notifications
New installs of RTIR notify Ccs when launching an Investigation.
diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 3f51584..291b829 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -342,6 +342,30 @@ our @Final = (
remove_scrip_condition('RTIR_BlockActivation');
},
+ sub {
+ my $queue = get_queue( 'Incident Reports' );
+
+ my $cf = RT::CustomField->new( $RT::SystemUser );
+ $cf->LoadByName( Name => 'SLA', Queue => $queue->id );
+ unless ( $cf->id ) {
+ $RT::Logger->error("Couldn't load SLA CF applied to queue '". $queue->Name ."'");
+ return;
+ }
+ next unless $queue && $cf;
+
+ {
+ my ($status, $msg) = $cf->RemoveFromObject( $queue );
+ $RT::Logger->error("Couldn't unapply custom field #". $cf->id .": $msg")
+ unless $status;
+ }
+
+ unless ( $cf->Disabled ) {
+ my ($status, $msg) = $cf->SetDisabled(1);
+ $RT::Logger->error("Couldn't disable custom field #". $cf->id .": $msg")
+ unless $status;
+ }
+ },
+
# replace conditions with RT's StatusChange
sub {
my %map = (
diff --git a/t/upgrade/2.6.0-to-2.9.0.t b/t/upgrade/2.6.0-to-2.9.0.t
index 015d6eb..f066030 100644
--- a/t/upgrade/2.6.0-to-2.9.0.t
+++ b/t/upgrade/2.6.0-to-2.9.0.t
@@ -8,7 +8,7 @@ BEGIN { unless ( $ENV{RTIR_TEST_UPGRADE} ) {
Test::More->import( skip_all => "Skipping upgrade tests, it's only for developers" );
} }
-use RT::IR::Test tests => 17;
+use RT::IR::Test tests => 18;
{
RT::IR::Test->import_snapshot( 'rtir-2.6.after-rt-upgrade.sql' );
my ($status, $msg) = RT::IR::Test->apply_upgrade( 'etc/upgrade/', '2.9.0' );
@@ -25,6 +25,16 @@ my @state_cf_ids;
}
{
+ my @sla_cf_ids;
+ my $cfs = RT::CustomFields->new( RT->SystemUser );
+ $cfs->Limit( FIELD => 'Name', VALUE => 'SLA' );
+ $cfs->Limit( FIELD => 'Disabled', VALUE => 1 );
+ push @sla_cf_ids, map $_->id, @{ $cfs->ItemsArrayRef };
+ is( scalar @sla_cf_ids, 1, 'one disabled SLA field' );
+}
+
+
+{
my $ticket = RT::Ticket->new( RT->SystemUser );
$ticket->Load(4);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list