[Rt-commit] rt branch, 3.999-trunk, updated. e85d523c05e61ab5dfe0bc2d43e75d57cea20712

sartak at bestpractical.com sartak at bestpractical.com
Wed Dec 2 06:07:07 EST 2009


The branch, 3.999-trunk has been updated
       via  e85d523c05e61ab5dfe0bc2d43e75d57cea20712 (commit)
      from  c105ecae8e339ae15ba7ea9921edaefe89702929 (commit)

Summary of changes:
 lib/RT/Model/Ticket.pm |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

- Log -----------------------------------------------------------------
commit e85d523c05e61ab5dfe0bc2d43e75d57cea20712
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Dec 2 06:03:56 2009 -0500

    canonicalize_started

diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index a3fbea5..a5204b6 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -474,16 +474,6 @@ sub create {
 # }}}
 
     # {{{ Dates
-    my $started;
-    if ( defined $args{'started'} ) {
-        $started = RT::DateTime->new_from_string($args{'started'});
-    } elsif ( !$queue_obj->status_schema->is_initial( $args{'status'} ) ) {
-        $started = RT::DateTime->now;
-    }
-    else {
-        $started = RT::DateTime->new_unset;
-    }
-
     my $resolved;
     if ( defined $args{'resolved'} ) {
         $resolved = RT::DateTime->new_from_string($args{'resolved'});
@@ -598,7 +588,7 @@ sub create {
         time_left        => $args{'time_left'},
         type             => $args{'type'},
         starts           => $args{'starts'},
-        started          => $started,
+        started          => $args{'started'},
         resolved         => $resolved,
         told             => $told,
         due              => $args{'due'},
@@ -877,15 +867,22 @@ Try to parse the starts date as a string.
 sub canonicalize_starts {
     my $self   = shift;
     my $starts = shift;
+    my $other  = shift;
 
     if (defined $starts) {
         return RT::DateTime->new_from_string($starts);
     }
 
-    return RT::DateTime->new_unset;
+    my $queue = $self->queue_id || $other->{queue};
+    my $queue_obj = RT::Model::Queue->new;
+    $queue_obj->load($queue);
 
-}
+    if ( !$queue_obj->status_schema->is_initial($other->{status}) ) {
+        return RT::DateTime->now;
+    }
 
+    return RT::DateTime->new_unset;
+}
 
 sub roles { return ( "cc", "admin_cc", "requestor" ); }
 

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


More information about the Rt-commit mailing list