summaryrefslogtreecommitdiff
path: root/rt/share/html/Elements
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-05-29 13:15:22 -0700
committerMark Wells <mark@freeside.biz>2013-05-29 13:15:22 -0700
commitea32f987f9c72ad6990bfa326af2935f79bf580c (patch)
tree727de18b686cbe93c571b85d3e5b6ea7132819c5 /rt/share/html/Elements
parentac272d7302249e13fbf07084087ae642059d63a0 (diff)
display date custom fields as real dates, #23121
Diffstat (limited to 'rt/share/html/Elements')
-rw-r--r--rt/share/html/Elements/ColumnMap40
-rw-r--r--rt/share/html/Elements/RT__Ticket/ColumnMap15
2 files changed, 32 insertions, 23 deletions
diff --git a/rt/share/html/Elements/ColumnMap b/rt/share/html/Elements/ColumnMap
index f268a5d1c..878950bff 100644
--- a/rt/share/html/Elements/ColumnMap
+++ b/rt/share/html/Elements/ColumnMap
@@ -64,8 +64,7 @@ my $COLUMN_MAP = {
Created => {
attribute => 'Created',
title => 'Created', # loc
- date => sub { return $_[0]->CreatedObj },
- value => sub { return $_[0]->CreatedObj->AsString }
+ value => sub { return $_[0]->CreatedObj },
},
CreatedRelative => {
attribute => 'Created',
@@ -80,8 +79,7 @@ my $COLUMN_MAP = {
LastUpdated => {
attribute => 'LastUpdated',
title => 'Last Updated', # loc
- date => sub { return $_[0]->LastUpdatedObj },
- value => sub { return $_[0]->LastUpdatedObj->AsString }
+ value => sub { return $_[0]->LastUpdatedObj },
},
LastUpdatedRelative => {
attribute => 'LastUpdated',
@@ -101,15 +99,31 @@ my $COLUMN_MAP = {
# Display custom field contents, separated by newlines.
# For Image custom fields we also show a thumbnail here.
- my $values = $_[0]->CustomFieldValues( $_[-1] );
- my @values = map {
- (
- ($_->CustomFieldObj->Type eq 'Image')
- ? \($m->scomp( '/Elements/ShowCustomFieldImage', Object => $_ ))
- : $_->Content
- ),
- \'<br />',
- } @{ $values->ItemsArrayRef };
+ my $object = shift;
+ my $cfname = pop;
+ my $values = $object->CustomFieldValues( $cfname );
+ return if $values->Count == 0;
+ my @values;
+ # it is guaranteed to be the same type for all fields, right?
+ my $v = $values->First;
+ my $cftype = $v->CustomFieldObj->Type;
+
+ do {
+ if ($cftype eq 'Image') {
+ push @values,
+ \($m->scomp( '/Elements/ShowCustomFieldImage',
+ Object => $v ));
+ } elsif ( $cftype eq 'Date' or $cftype eq 'DateTime' ) {
+ # then actually return the date object;
+ # ProcessColumnMapValue will stringify it
+ my $DateObj = RT::Date->new( $session{'CurrentUser'} );
+ $DateObj->Set(Format => 'unknown', Value => $v->Content);
+ push @values, $DateObj;
+ } else {
+ push @values, $v->Content;
+ }
+ push @values, \'<br />'; # this is deeply silly
+ } while ($v = $values->Next);
pop @values; # Remove that last <br />
return @values;
},
diff --git a/rt/share/html/Elements/RT__Ticket/ColumnMap b/rt/share/html/Elements/RT__Ticket/ColumnMap
index 787862d6a..239e58183 100644
--- a/rt/share/html/Elements/RT__Ticket/ColumnMap
+++ b/rt/share/html/Elements/RT__Ticket/ColumnMap
@@ -220,32 +220,27 @@ $COLUMN_MAP = {
Starts => {
title => 'Starts', # loc
attribute => 'Starts',
- date => sub { return $_[0]->StartsObj },
- value => sub { return $_[0]->StartsObj->AsString }
+ value => sub { return $_[0]->StartsObj }
},
Started => {
title => 'Started', # loc
attribute => 'Started',
- date => sub { return $_[0]->StartedObj },
- value => sub { return $_[0]->StartedObj->AsString }
+ value => sub { return $_[0]->StartedObj },
},
Told => {
title => 'Told', # loc
attribute => 'Told',
- date => sub { return $_[0]->ToldObj },
- value => sub { return $_[0]->ToldObj->AsString }
+ value => sub { return $_[0]->ToldObj },
},
Due => {
title => 'Due', # loc
attribute => 'Due',
- date => sub { return $_[0]->DueObj },
- value => sub { return $_[0]->DueObj->AsString }
+ value => sub { return $_[0]->DueObj },
},
Resolved => {
title => 'Resolved', # loc
attribute => 'Resolved',
- date => sub { return $_[0]->ResolvedObj },
- value => sub { return $_[0]->ResolvedObj->AsString }
+ value => sub { return $_[0]->ResolvedObj }
},
UpdateStatus => {
title => 'New messages', # loc