[Bps-public-commit] rt-extension-jsgantt branch, master, updated. fb70ef0f8a75a7f22447462d6f38e2ea88f158a2

? sunnavy sunnavy at bestpractical.com
Wed Feb 2 01:56:55 EST 2011


The branch, master has been updated
       via  fb70ef0f8a75a7f22447462d6f38e2ea88f158a2 (commit)
      from  bd433cdf5d3e201c30bca664ad5724cec307ba86 (commit)

Summary of changes:
 lib/RT/Extension/JSGantt.pm |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

- Log -----------------------------------------------------------------
commit fb70ef0f8a75a7f22447462d6f38e2ea88f158a2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Feb 2 14:57:01 2011 +0800

    should get $start asap

diff --git a/lib/RT/Extension/JSGantt.pm b/lib/RT/Extension/JSGantt.pm
index 43557ed..c8d4e4d 100644
--- a/lib/RT/Extension/JSGantt.pm
+++ b/lib/RT/Extension/JSGantt.pm
@@ -148,6 +148,23 @@ sub _GetTimeRange {
     my ( $start_obj, $start ) = _GetDate( $Ticket, 'Starts', 'Started' );
     my ( $end_obj, $end ) = _GetDate( $Ticket, 'Due' );
 
+    if ( !$start ) {
+        my $Transactions = $Ticket->Transactions;
+        while ( my $Transaction = $Transactions->Next ) {
+            next
+              unless $Transaction->TimeTaken
+                  || (   $Transaction->Type eq 'Set'
+                      && $Transaction->Field eq 'TimeWorked'
+                      && $Transaction->NewValue > $Transaction->OldValue );
+            $start_obj = $Transaction->CreatedObj;
+            my ( $day, $month, $year ) =
+              ( $start_obj->Localtime('user') )[ 3, 4, 5 ];
+            $start = join '/', $month + 1, $day, $year;
+            last;
+        }
+    }
+
+
     # if $start or $end is empty still
     unless ( $start && $end ) {
         my $hours_per_day = RT->Config->Get('JSGanttWorkingHoursPerDay')
@@ -185,22 +202,6 @@ sub _GetTimeRange {
     }
 
     if ( !$start ) {
-        my $Transactions = $Ticket->Transactions;
-        while ( my $Transaction = $Transactions->Next ) {
-            next
-              unless $Transaction->TimeTaken
-                  || (   $Transaction->Type eq 'Set'
-                      && $Transaction->Field eq 'TimeWorked'
-                      && $Transaction->NewValue > $Transaction->OldValue );
-            $start_obj = $Transaction->CreatedObj;
-            my ( $day, $month, $year ) =
-              ( $start_obj->Localtime('user') )[ 3, 4, 5 ];
-            $start = join '/', $month + 1, $day, $year;
-            last;
-        }
-    }
-
-    if ( !$start ) {
         $RT::Logger->warning( "Ticket "
               . $Ticket->id
               . " doesn't have Starts/Started defined, and we can't figure it out either"

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



More information about the Bps-public-commit mailing list