[Rt-commit] rt branch, 4.4/rest-1-sla, created. rt-4.4.2-99-g472f90ee6

? sunnavy sunnavy at bestpractical.com
Wed Mar 21 17:48:07 EDT 2018


The branch, 4.4/rest-1-sla has been created
        at  472f90ee615a68ae83320590c1b55330e6877fcf (commit)

- Log -----------------------------------------------------------------
commit 472f90ee615a68ae83320590c1b55330e6877fcf
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Feb 12 22:43:09 2018 +0800

    add SLA field support on REST 1

diff --git a/share/html/REST/1.0/Forms/queue/default b/share/html/REST/1.0/Forms/queue/default
index 34f89b0fe..985cd44b7 100644
--- a/share/html/REST/1.0/Forms/queue/default
+++ b/share/html/REST/1.0/Forms/queue/default
@@ -60,7 +60,7 @@ my %data = %$changes;
 my $queue = RT::Queue->new($session{CurrentUser});
 
 my @fields =
-  qw(Name Description CorrespondAddress CommentAddress Disabled);
+  qw(Name Description CorrespondAddress CommentAddress Disabled SLADisabled);
 if ( $fields && %$fields ) {
     @fields = grep { exists $fields->{ lc $_ } } @fields;
 }
@@ -84,6 +84,7 @@ else {
                 Description => "",
                 CommentAddress => "",
                 CorrespondAddress => "",
+                SLADisabled => 1,
             },
             0
         ];
diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index 10b036183..27789c789 100644
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -67,7 +67,7 @@ my @dates  = qw(Created Starts Started Due Resolved Told LastUpdated);
 my @people = qw(Requestors Cc AdminCc);
 my @create = qw(Queue Requestor Subject Cc AdminCc Owner Status Priority
                 InitialPriority FinalPriority TimeEstimated TimeWorked
-                TimeLeft Starts Started Due Resolved Content-Type);
+                TimeLeft Starts Started Due Resolved Content-Type SLA);
 my @simple = qw(Subject Status Priority Disabled TimeEstimated TimeWorked
                 TimeLeft InitialPriority FinalPriority);
 my %dates  = map {lc $_ => $_} @dates;
@@ -117,7 +117,8 @@ else {
         return [
             "# Required: id, Queue",
             [ qw(id Queue Requestor Subject Cc AdminCc Owner Status Priority
-                 InitialPriority FinalPriority TimeEstimated Starts Due Attachment Text) ],
+                 InitialPriority FinalPriority TimeEstimated Starts Due),
+                 ( $queue->SLADisabled ? () : 'SLA' ), qw(Attachment Text) ],
             {
                 id               => "ticket/new",
                 Queue            => $queue->Name,
@@ -133,6 +134,7 @@ else {
                 TimeEstimated    => 0,
                 Starts           => $starts->ISO(Timezone => 'user'),
                 Due              => $due->IsSet ? $due->ISO(Timezone => 'user') : undef,
+                SLA              => '',
                 Attachment       => '',
                 Text             => "",
             },
@@ -271,6 +273,10 @@ if (!keys(%data)) {
         push @data, [ $key => $val ];
     }
 
+    if ( !$ticket->QueueObj->SLADisabled && (!%$fields || (exists $fields->{sla})) ) {
+        push @data, [ SLA => $ticket->SLA ];
+    }
+
     # Display custom fields
     my $CustomFields = $ticket->CustomFields;
     while (my $cf = $CustomFields->Next()) {
@@ -465,6 +471,11 @@ else {
                 }
             }
         }
+        elsif ( $key eq 'sla' ) {
+            my $current = $ticket->SLA // '';
+            next if $val eq $current;
+            ($n, $s) = $ticket->SetSLA($val);
+        }
         elsif ($key ne 'id' && $key ne 'type' && $key ne 'creator' && $key ne 'content-type' ) {
             $n = 0;
             $s = "Unknown field.";

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


More information about the rt-commit mailing list