[rt-users] Is it possible to change the date format for some specific searches

Alex Peters alex at peters.net
Fri Dec 12 07:06:56 EST 2014


If you're willing to write some code, you could create a callback that
modifies the $COLUMN_MAP variable, which defines all of the different
column types and how they are prepared.  You could then create a column
called "DueDate" which outputs just the date of the due date/time.

Create
$RTHOME/local/html/Callbacks/DueDate/Elements/RT__Ticket/ColumnMap/Once
with this content:

<%args>
$COLUMN_MAP
</%args>
<%init>
$COLUMN_MAP->{'DueDate'} = {
    title     => 'Due', # loc
    attribute => 'Due',
    value     => sub {
        my $ticket = shift;
        my $date = $ticket->DueObj;
        return '' if not $date->IsSet;
        return $date->Date;
    }
};
</%init>

Then, clear your Mason cache and restart your RT server:

http://requesttracker.wikia.com/wiki/CleanMasonCache

You should now see a "DueDate" choice when building searches.  The code can
be copied for other date/time values, or you could put a loop into the code
above.

On 5 December 2014 at 01:41, Gaston Huot <Gaston at huot.me> wrote:
>
> Is it possible to change the date format for some specific searches (eg.
> just the date without the time)? I don't want to change the general option
> (in user General preferences).
>
> '<b><a
> href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
> '<b><a
> href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
> Owner,
> *'<small>__LastUpdated__</small>/TITLE:MAJ'*
>
>
> Gaston
> 514.823-7202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20141212/95bd0b46/attachment.htm>


More information about the rt-users mailing list