Skip to content

Commit

Permalink
Merge branch '4.2/rest-default-due' into 4.2-trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
jibsheet committed Oct 23, 2014
2 parents 31d5b4d + 1f92703 commit 5b4a100
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions share/html/REST/1.0/Forms/ticket/default
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ else {
if (!keys(%data)) {
# GET ticket/new: Return a suitable default form.
# We get defaults from queue/1 (XXX: What if it isn't there?).
my $due = RT::Date->new($session{CurrentUser});
my $queue = RT::Queue->new($session{CurrentUser});
my $starts = RT::Date->new($session{CurrentUser});
$queue->Load(1);
$due->SetToNow;
$due->AddDays($queue->DefaultDueIn) if $queue->DefaultDueIn;

my $due;
if ($queue->DefaultDueIn) {
$due = RT::Date->new($session{CurrentUser});
$due->SetToNow;
$due->AddDays($queue->DefaultDueIn);
}
my $starts = RT::Date->new($session{CurrentUser});
$starts->SetToNow;

return [
Expand All @@ -124,8 +128,8 @@ else {
InitialPriority => $queue->InitialPriority,
FinalPriority => $queue->FinalPriority,
TimeEstimated => 0,
Starts => $starts->ISO,
Due => $due->ISO,
Starts => $starts->ISO(Timezone => 'user'),
Due => $due ? $due->ISO(Timezone => 'user') : undef,
Attachment => '',
Text => "",
},
Expand Down

0 comments on commit 5b4a100

Please sign in to comment.