[Rt-commit] rt branch, 4.4/rest-1-sla, created. rt-4.4.2-74-gb6392901c
? sunnavy
sunnavy at bestpractical.com
Mon Feb 12 09:50:25 EST 2018
The branch, 4.4/rest-1-sla has been created
at b6392901c1f097fc56ea27c75428c1d16a1e5ca1 (commit)
- Log -----------------------------------------------------------------
commit b6392901c1f097fc56ea27c75428c1d16a1e5ca1
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..a4a86405a 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,11 @@ if (!keys(%data)) {
push @data, [ $key => $val ];
}
+ if ( !$ticket->QueueObj->SLADisabled ) {
+ next unless (!%$fields || (exists $fields->{sla}));
+ push @data, [ SLA => $ticket->SLA ];
+ }
+
# Display custom fields
my $CustomFields = $ticket->CustomFields;
while (my $cf = $CustomFields->Next()) {
@@ -465,6 +472,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