[rt-users] Question on display of dates on queries
Stephen Turner
sturner at MIT.EDU
Tue Apr 1 16:25:41 EDT 2008
At Tuesday 4/1/2008 04:10 PM, Kenneth Crocker wrote:
>Steve,
>
>
> I'll check it out and if I can get it to work, I'll
> certainly pass it on.
>
>
>Kenn
>LBNL
Here's what we've done to display different date formats on the search results:
1. New callback:
$RT_HOME/local/html/Callbacks/xxxxx/Elements/RT__Ticket/ColumnMap
Contents of this callback:
<%ARGS>
$COLUMN_MAP => undef
</%ARGS>
<%init>
$COLUMN_MAP->{'CreatedShort'} = {
title => 'Created',
attribute => 'Created',
value => sub {
return ("Not set") if ($_[0]->CreatedObj->Unix <= 0);
my ($date, $time) = split(' ', $_[0]->CreatedObj->ISO);
my ($y, $m, $d) = split ('-', $date);
return "$m/$d/$y";
}
};
</%init>
2. In html/Search/Elements/BuildFormatString, find the definition of
@fields and add "CreatedShort" to it:
e.g. before:
my @fields = qw(
id
Status
ExtendedStatus
Subject
QueueName
after:
my @fields = qw(
id
Status
ExtendedStatus
Subject
CreatedShort
QueueName
The callback will format the field as MM/DD/YY. The mod to
BuildFormatString will make "CreatedShort" appear in Query Builder in
the list of fields that can be added to the results.
I only showed the part of our mods that provide a shortened "Created"
date - you can extend this for any of the ticket dates.
Steve
More information about the rt-users
mailing list