[Rt-commit] rt branch, 4.4/disable-sla-by-default, created. rt-4.2.12-374-gbb95b60

? sunnavy sunnavy at bestpractical.com
Fri Oct 30 13:32:02 EDT 2015


The branch, 4.4/disable-sla-by-default has been created
        at  bb95b60d480418143f211137286fa89e96fb5cc5 (commit)

- Log -----------------------------------------------------------------
commit aa4c748f63d1f7c8c91cac9d3da904b5bd69749e
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 31 01:09:18 2015 +0800

    SLA is not common enough to enable by default
    
    Fixes: I#31310

diff --git a/etc/schema.Oracle b/etc/schema.Oracle
index af9c4f8..5e8da10 100644
--- a/etc/schema.Oracle
+++ b/etc/schema.Oracle
@@ -34,7 +34,7 @@ CREATE TABLE Queues (
         Created                 DATE,
         LastUpdatedBy           NUMBER(11,0) DEFAULT 0 NOT NULL,
         LastUpdated             DATE,
-        SLADisabled             NUMBER(11,0) DEFAULT 0 NOT NULL,
+        SLADisabled             NUMBER(11,0) DEFAULT 1 NOT NULL,
         Disabled                NUMBER(11,0) DEFAULT 0 NOT NULL
 );
 CREATE UNIQUE INDEX Queues1 ON Queues (LOWER(Name));
diff --git a/etc/schema.Pg b/etc/schema.Pg
index 9179cc6..c88b0a6 100644
--- a/etc/schema.Pg
+++ b/etc/schema.Pg
@@ -57,7 +57,7 @@ CREATE TABLE Queues (
   Created TIMESTAMP NULL  ,
   LastUpdatedBy integer NOT NULL DEFAULT 0  ,
   LastUpdated TIMESTAMP NULL  ,
-  SLADisabled integer NOT NULL DEFAULT 0 ,
+  SLADisabled integer NOT NULL DEFAULT 1 ,
   Disabled integer NOT NULL DEFAULT 0 ,
   PRIMARY KEY (id)
 
diff --git a/etc/schema.SQLite b/etc/schema.SQLite
index 632cfa0..6d20362 100644
--- a/etc/schema.SQLite
+++ b/etc/schema.SQLite
@@ -35,7 +35,7 @@ CREATE TABLE Queues (
   Created DATETIME NULL  ,
   LastUpdatedBy integer NULL DEFAULT 0 ,
   LastUpdated DATETIME NULL  ,
-  SLADisabled int2 NOT NULL DEFAULT 0,
+  SLADisabled int2 NOT NULL DEFAULT 1,
   Disabled int2 NOT NULL DEFAULT 0 
  
 ) ;
diff --git a/etc/schema.mysql b/etc/schema.mysql
index ca251c2..597e10e 100644
--- a/etc/schema.mysql
+++ b/etc/schema.mysql
@@ -31,7 +31,7 @@ CREATE TABLE Queues (
   Created DATETIME NULL  ,
   LastUpdatedBy integer NOT NULL DEFAULT 0  ,
   LastUpdated DATETIME NULL  ,
-  SLADisabled int2 NOT NULL DEFAULT 0 ,
+  SLADisabled int2 NOT NULL DEFAULT 1 ,
   Disabled int2 NOT NULL DEFAULT 0 ,
   PRIMARY KEY (id)
 ) ENGINE=InnoDB CHARACTER SET utf8;
diff --git a/etc/upgrade/4.3.8/schema.Oracle b/etc/upgrade/4.3.8/schema.Oracle
index 1e78116..c6d786f 100644
--- a/etc/upgrade/4.3.8/schema.Oracle
+++ b/etc/upgrade/4.3.8/schema.Oracle
@@ -1,2 +1,2 @@
 ALTER TABLE Tickets ADD SLA VARCHAR2(64) NULL;
-ALTER TABLE Queues ADD SLADisabled NUMBER(11,0) DEFAULT 0 NOT NULL;
+ALTER TABLE Queues ADD SLADisabled NUMBER(11,0) DEFAULT 1 NOT NULL;
diff --git a/etc/upgrade/4.3.8/schema.Pg b/etc/upgrade/4.3.8/schema.Pg
index 7df4453..1d26f87 100644
--- a/etc/upgrade/4.3.8/schema.Pg
+++ b/etc/upgrade/4.3.8/schema.Pg
@@ -1,2 +1,2 @@
 ALTER TABLE Tickets ADD COLUMN SLA VARCHAR(64) NULL;
-ALTER TABLE Queues ADD COLUMN SLADisabled integer NOT NULL DEFAULT 0;
+ALTER TABLE Queues ADD COLUMN SLADisabled integer NOT NULL DEFAULT 1;
diff --git a/etc/upgrade/4.3.8/schema.SQLite b/etc/upgrade/4.3.8/schema.SQLite
index 7d89190..bd5710e 100644
--- a/etc/upgrade/4.3.8/schema.SQLite
+++ b/etc/upgrade/4.3.8/schema.SQLite
@@ -1,2 +1,2 @@
 ALTER TABLE Tickets ADD COLUMN SLA VARCHAR(64) NULL;
-ALTER TABLE Queues ADD COLUMN SLADisabled int2 NOT NULL DEFAULT 0;
+ALTER TABLE Queues ADD COLUMN SLADisabled int2 NOT NULL DEFAULT 1;
diff --git a/etc/upgrade/4.3.8/schema.mysql b/etc/upgrade/4.3.8/schema.mysql
index 7d89190..bd5710e 100644
--- a/etc/upgrade/4.3.8/schema.mysql
+++ b/etc/upgrade/4.3.8/schema.mysql
@@ -1,2 +1,2 @@
 ALTER TABLE Tickets ADD COLUMN SLA VARCHAR(64) NULL;
-ALTER TABLE Queues ADD COLUMN SLADisabled int2 NOT NULL DEFAULT 0;
+ALTER TABLE Queues ADD COLUMN SLADisabled int2 NOT NULL DEFAULT 1;
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 3d223e5..ef878f9 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -816,7 +816,7 @@ sub load_or_create_queue {
         my ($val, $msg) = $obj->Create( %args );
         die "$msg" unless $val;
     } else {
-        my @fields = qw(CorrespondAddress CommentAddress);
+        my @fields = qw(CorrespondAddress CommentAddress SLADisabled);
         foreach my $field ( @fields ) {
             next unless exists $args{ $field };
             next if $args{ $field } eq ($obj->$field || '');
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index ec323c7..f0bd8f4 100644
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -97,7 +97,7 @@
 </tr>
 
 <tr><td align="right"><input type="checkbox" class="checkbox" id="SLAEnabled" name="SLAEnabled" value="1" 
-% if ( $Create || !$QueueObj->SLADisabled ) {
+% if ( $QueueObj->id && !$QueueObj->SLADisabled ) {
 checked="checked"
 % }
  /></td>
diff --git a/t/sla/business_hours.t b/t/sla/business_hours.t
index 6e64782..939220b 100644
--- a/t/sla/business_hours.t
+++ b/t/sla/business_hours.t
@@ -8,6 +8,8 @@ use RT::Test tests => undef;
 $ENV{'TZ'} = 'GMT';
 RT->Config->Set( Timezone => 'GMT' );
 
+RT::Test->load_or_create_queue( Name => 'General', SLADisabled => 0 );
+
 diag 'check business hours' if $ENV{'TEST_VERBOSE'};
 {
 
diff --git a/t/sla/due.t b/t/sla/due.t
index 7fb96c9..120cc82 100644
--- a/t/sla/due.t
+++ b/t/sla/due.t
@@ -3,6 +3,8 @@ use warnings;
 
 use RT::Test tests => undef;
 
+RT::Test->load_or_create_queue( Name => 'General', SLADisabled => 0 );
+
 diag 'check change of Due date when SLA for a ticket is changed' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
diff --git a/t/sla/ignore-on-statuses.t b/t/sla/ignore-on-statuses.t
index 496f530..3d39da8 100644
--- a/t/sla/ignore-on-statuses.t
+++ b/t/sla/ignore-on-statuses.t
@@ -3,6 +3,8 @@ use warnings;
 
 use RT::Test tests => undef;
 
+RT::Test->load_or_create_queue( Name => 'General', SLADisabled => 0 );
+
 diag 'check that reply to requestors dont unset due date with KeepInLoop' if $ENV{'TEST_VERBOSE'};
 {
     %RT::ServiceAgreements = (
diff --git a/t/sla/queue.t b/t/sla/queue.t
index a782530..891976c 100644
--- a/t/sla/queue.t
+++ b/t/sla/queue.t
@@ -4,9 +4,7 @@ use warnings;
 use Test::MockTime qw( :all );
 use RT::Test tests => undef;
 
-my $queue = RT::Queue->new($RT::SystemUser);
-$queue->Load('General');
-
+my $queue = RT::Test->load_or_create_queue( Name => 'General', SLADisabled => 0 );
 my $queue_sla = RT::Attribute->new($RT::SystemUser);
 
 diag 'check set of Due date with Queue default SLA' if $ENV{'TEST_VERBOSE'};
diff --git a/t/sla/starts.t b/t/sla/starts.t
index 80f52a9..4e9951c 100644
--- a/t/sla/starts.t
+++ b/t/sla/starts.t
@@ -4,6 +4,8 @@ use warnings;
 use Test::MockTime qw( :all );
 use RT::Test tests => undef;
 
+RT::Test->load_or_create_queue( Name => 'General', SLADisabled => 0 );
+
 # we assume the RT's Timezone is UTC now, need a smart way to get over that.
 $ENV{'TZ'} = 'GMT';
 RT->Config->Set( Timezone => 'GMT' );
diff --git a/t/sla/timezone.t b/t/sla/timezone.t
index 4ec7837..29a73b2 100644
--- a/t/sla/timezone.t
+++ b/t/sla/timezone.t
@@ -4,10 +4,10 @@ use warnings;
 use Test::MockTime qw( :all );
 use RT::Test tests => undef;
 
-my $ru_queue = RT::Test->load_or_create_queue( Name => 'RU' );
+my $ru_queue = RT::Test->load_or_create_queue( Name => 'RU', SLADisabled => 0 );
 ok $ru_queue && $ru_queue->id, 'created RU queue';
 
-my $us_queue = RT::Test->load_or_create_queue( Name => 'US' );
+my $us_queue = RT::Test->load_or_create_queue( Name => 'US', SLADisabled => 0 );
 ok $us_queue && $ru_queue->id, 'created US queue';
 
 no warnings 'once';
diff --git a/t/sla/web.t b/t/sla/web.t
index b59cccd..44f20d7 100644
--- a/t/sla/web.t
+++ b/t/sla/web.t
@@ -27,7 +27,7 @@ BEGIN {
 
 my $now = TIME;
 
-my $queue = RT::Test->load_or_create_queue( Name => 'General' );
+my $queue = RT::Test->load_or_create_queue( Name => 'General', SLADisabled => 0 );
 
 my $user = RT::Test->load_or_create_user(
     Name         => 'user',

commit bb95b60d480418143f211137286fa89e96fb5cc5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 31 01:13:17 2015 +0800

    alert when SLA is enabled but %ServiceAgreements is not set

diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index f0bd8f4..b20c540 100644
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -236,6 +236,9 @@ if ( $QueueObj->Id ) {
             push @no_redirect_results, loc("RTAddressRegexp option in the config doesn't match [_1]", $address );
         }
     }
+    if ( !$QueueObj->SLADisabled && !( RT->Config->Get('ServiceAgreements') && keys %{RT->Config->Get('ServiceAgreements')}) ) {
+        push @no_redirect_results, loc("You enabled [_1] but [_2] hasn't been configured in RT_SiteConfig.pm, please check '[_3]' for more help", 'SLA', '%ServiceAgreements', 'docs/customizing/sla.pod');
+    }
 } else {
     $title = loc("Create a queue");
 }

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


More information about the rt-commit mailing list