[Rt-commit] rt branch, 4.2/rest-default-due, created. rt-4.2.3-57-g1f92703

Alex Vandiver alexmv at bestpractical.com
Thu Mar 20 21:06:21 EDT 2014


The branch, 4.2/rest-default-due has been created
        at  1f92703a49ec295c5d15aae406b037f671ccd541 (commit)

- Log -----------------------------------------------------------------
commit 075c9ec463d527ad9e2aca7d8319e82eecb87c5d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 20 20:59:38 2014 -0400

    Stop defaulting the due date to the creation time in REST
    
    If no DefaultDueIn existed on queue 1, the due date was set to the
    current date and time.  Only provide a Due date if DefaultDueIn was set.

diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index 3bf6fb7..fac3d46 100644
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -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 [
@@ -125,7 +129,7 @@ else {
                 FinalPriority    => $queue->FinalPriority,
                 TimeEstimated    => 0,
                 Starts           => $starts->ISO,
-                Due              => $due->ISO,
+                Due              => $due ? $due->ISO : undef,
                 Attachment       => '',
                 Text             => "",
             },

commit 1f92703a49ec295c5d15aae406b037f671ccd541
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Mar 20 21:06:18 2014 -0400

    Send dates back to the user in the user's own timezone
    
    Resolves issues #20334

diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index fac3d46..769ccde 100644
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -128,8 +128,8 @@ else {
                 InitialPriority  => $queue->InitialPriority,
                 FinalPriority    => $queue->FinalPriority,
                 TimeEstimated    => 0,
-                Starts           => $starts->ISO,
-                Due              => $due ? $due->ISO : undef,
+                Starts           => $starts->ISO(Timezone => 'user'),
+                Due              => $due ? $due->ISO(Timezone => 'user') : undef,
                 Attachment       => '',
                 Text             => "",
             },

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


More information about the rt-commit mailing list