[Rt-commit] rt branch, 3.8-trunk, updated. 7a5c5c9109e63792c18fefe8dff2cfd99d2803df

Ruslan Zakirov ruz at bestpractical.com
Fri Aug 14 14:15:22 EDT 2009


The branch, 3.8-trunk has been updated
       via  7a5c5c9109e63792c18fefe8dff2cfd99d2803df (commit)
       via  22ce1dc893259394411f20465f11acbfd4529d25 (commit)
      from  e34bc151035634a66ce9f878799571d9b9cf496b (commit)

Summary of changes:
 lib/RT/Ticket_Overlay.pm                 |   32 +++++++++++++++++++++--------
 share/html/Elements/RT__Ticket/ColumnMap |    2 +-
 2 files changed, 24 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit 22ce1dc893259394411f20465f11acbfd4529d25
Author: Ruslan Zakirov <ruz at bestpractica.com>
Date:   Thu Aug 13 18:18:42 2009 +0400

    add TimeLeftAsString to be consistent with other time fields
    
    Thanks to Max Kosmach for the patch

diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index 085b9b4..f2f22c9 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -1960,20 +1960,34 @@ Returns the amount of time worked on this ticket as a Text String
 
 sub TimeWorkedAsString {
     my $self = shift;
-    return "0" unless $self->TimeWorked;
+    my $value = $self->TimeWorked;
 
-    #This is not really a date object, but if we diff a number of seconds 
-    #vs the epoch, we'll get a nice description of time worked.
+    # return the # of minutes worked turned into seconds and written as
+    # a simple text string, this is not really a date object, but if we
+    # diff a number of seconds vs the epoch, we'll get a nice description
+    # of time worked.
+    return "" unless $value;
+    return RT::Date->new( $self->CurrentUser )
+        ->DurationAsString( $value * 60 );
+}
 
-    my $worked = new RT::Date( $self->CurrentUser );
+# }}}
 
-    #return the  #of minutes worked turned into seconds and written as
-    # a simple text string
+# {{{ sub TimeLeftAsString
 
-    return ( $worked->DurationAsString( $self->TimeWorked * 60 ) );
-}
+=head2  TimeLeftAsString
 
-# }}}
+Returns the amount of time left on this ticket as a Text String
+
+=cut
+
+sub TimeLeftAsString {
+    my $self = shift;
+    my $value = $self->TimeLeft;
+    return "" unless $value;
+    return RT::Date->new( $self->CurrentUser )
+        ->DurationAsString( $value * 60 );
+}
 
 # }}}
 
diff --git a/share/html/Elements/RT__Ticket/ColumnMap b/share/html/Elements/RT__Ticket/ColumnMap
index 2931737..c08796a 100644
--- a/share/html/Elements/RT__Ticket/ColumnMap
+++ b/share/html/Elements/RT__Ticket/ColumnMap
@@ -162,7 +162,7 @@ $COLUMN_MAP = {
     TimeLeft => {
         attribute => 'TimeLeft',
         title     => 'Time Left', # loc
-        value     => sub { return $_[0]->TimeLeft }
+        value     => sub { return $_[0]->TimeLeftAsString }
     },
     TimeEstimated => {
         attribute => 'TimeEstimated',

commit 7a5c5c9109e63792c18fefe8dff2cfd99d2803df
Merge: 22ce1dc e34bc15
Author: Ruslan Zakirov <ruz at bestpractica.com>
Date:   Fri Aug 14 19:18:25 2009 +0400

    Merge branch '3.8-trunk' of git+ssh://diesel.bestpractical.com/git/rt into 3.8-trunk


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


More information about the Rt-commit mailing list