Question on display of dates on queries

To all,

A user came to me with a good question; how do I get the due date, or 

any other date field, to display ONLY the date and drop the time? I had
no answer. Anyone?
Also in the Query arena, I noticed that the ticket “owner” is listed as
a field that can be displayed, but NOT as a field to sort by. Anyone?
Thanks in advance.

Kenn
LBNL

Back on January 24 I asked:

I want to change the date format (for Due) in the search results page such
that it doesn’t display the time. I.e. I want something like: Tue Jan 22
2007. I’m sure that if I can find the relevant source code snippet I can
figure out how to change it, but I can’t seem to find it.

I got a reply from Emmanuel Lacour (thanks Emmanuel):

Seems to be here:

share/html/Elements//RT__Ticket/ColumnMap, line 287

Unfortunately, when I looked there I wasn’t smart enough to figure out how
to do what I wanted (and didn’t have time to pursue it).
If you do get it to work, please educate the rest of us :-).

Thanks,
Steve HolmesOn Tue, Apr 1, 2008 at 2:46 PM, Kenneth Crocker KFCrocker@lbl.gov wrote:

To all,

   A user came to me with a good question; how do I get the due date,

or
any other date field, to display ONLY the date and drop the time? I had
no answer. Anyone?
Also in the Query arena, I noticed that the ticket “owner” is
listed as
a field that can be displayed, but NOT as a field to sort by. Anyone?
Thanks in advance.

Kenn
LBNL

Steve,

I'll check it out and if I can get it to work, I'll certainly pass it on.

Kenn
LBNLOn 4/1/2008 12:28 PM, Steve Holmes wrote:

Back on January 24 I asked:

I want to change the date format (for Due) in the search results
page such that it doesn't display the time. I.e. I want something
like: Tue Jan 22 2007. I'm sure that if I can find the relevant
source code snippet I can figure out how to change it, but I can't
seem to find it. 

I got a reply from Emmanuel Lacour (thanks Emmanuel):

Seems to be here:

share/html/Elements//RT__Ticket/ColumnMap, line 287

Unfortunately, when I looked there I wasn’t smart enough to figure out
how to do what I wanted (and didn’t have time to pursue it).
If you do get it to work, please educate the rest of us :-).

Thanks,
Steve Holmes

On Tue, Apr 1, 2008 at 2:46 PM, Kenneth Crocker <KFCrocker@lbl.gov mailto:KFCrocker@lbl.gov> wrote:

To all,


       A user came to me with a good question; how do I get the due
date, or
any other date field, to display ONLY the date and drop the time? I had
no answer. Anyone?
       Also in the Query arena, I noticed that the ticket "owner" is
listed as
a field that can be displayed, but NOT as a field to sort by. Anyone?
       Thanks in advance.


Kenn
LBNL

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>

  1. 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