Reverse (date) order in Ticket History

Hi,

did somebody patched the RT2 code (2-0-11) to
show the hostory in a reverse order (means
the last Change is on the beginning of the history,
the creation of of the ticket is the last entry of
the history) ??

I think, i have to change
/opt/rt2/WebRT/html/Ticket/Elements/ShowHistory
but i don’t know the internal data structure …

Maybe somebody give me a hint?

Merci
Danny

did somebody patched the RT2 code (2-0-11) to
show the hostory in a reverse order (means

I think, i have to change
/opt/rt2/WebRT/html/Ticket/Elements/ShowHistory
but i don’t know the internal data structure …

In the above file, you will need to add ordering to the Transactions
variable, so after:

my $Transactions = $Ticket->Transactions;

add:

$Transactions->OrderBy( FIELD => 'id',
			ORDER => 'DESC' );

( default ordering is ASCending )

Regards,

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations

Bruce Campbell wrote:

did somebody patched the RT2 code (2-0-11) to
show the hostory in a reverse order (means

I think, i have to change
/opt/rt2/WebRT/html/Ticket/Elements/ShowHistory
but i don’t know the internal data structure …

In the above file, you will need to add ordering to the Transactions
variable, so after:

    my $Transactions = $Ticket->Transactions;

add:

    $Transactions->OrderBy( FIELD => 'id',
                            ORDER => 'DESC' );

( default ordering is ASCending )

Cool - Thank you very much !! It works great !

Tschau

Danny

DT Netsolution GmbH - Talaeckerstr. 30 - D-70437 Stuttgart
Tel: +49-711-849910-32 Fax: +49-711-849910-932
WEB: http://www.dtnet.de/ email: schwager@dtnet.de

-----Original Message-----
From: Bruce Campbell [mailto:bruce_campbell@ripe.net]

did somebody patched the RT2 code (2-0-11) to
show the hostory in a reverse order (means

I think, i have to change
/opt/rt2/WebRT/html/Ticket/Elements/ShowHistory
but i don’t know the internal data structure …

In the above file, you will need to add ordering to the Transactions
variable, so after:

my $Transactions = $Ticket->Transactions;

add:

$Transactions->OrderBy( FIELD => ‘id’,
ORDER => ‘DESC’ );

( default ordering is ASCending )

Works great! But I would like to make this happen only on certain queues.
I’m really new at hacking RT (as in I started 30 minutes ago), so I
haven’t got this working yet. So far I’ve got this:

my $Transactions = $Ticket->Transactions;

if ($Ticket->QueueObj->Name == ‘webrequest’)
{
$Transactions->OrderBy ( FIELD => ‘id’,
ORDER => ‘DESC’ );
}

…which reverses the history order for tickets in all queues, not just
webrequest (which was my aim). I’m also not that whippy at perl in general,
so it’s possible I’ve made some really doofy error. What am I missing here?
Kendric Beachey

my $Transactions = $Ticket->Transactions;

if ($Ticket->QueueObj->Name == ‘webrequest’)

‘==’ is a binary numeric comparison, and in the above essentially resolves
to ‘if( 1 == 1 )’. Try instead:

if( $Ticket->QueueObj->Name =~ /webrequest/i )

Although I’d make it easier for the behaviour to be extended to other
queues in future, and:

my $queues_reverse = "webrequest test example_queue";
if( $queues_reverse =~ /$Ticket->QueueObj->Name/ )

Regards,

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations

-----Original Message-----
From: Bruce Campbell [mailto:bruce_campbell@ripe.net]

my $Transactions = $Ticket->Transactions;

if ($Ticket->QueueObj->Name == ‘webrequest’)

‘==’ is a binary numeric comparison, and in the above
essentially resolves
to ‘if( 1 == 1 )’. Try instead:

if( $Ticket->QueueObj->Name =~ /webrequest/i )

Although I’d make it easier for the behaviour to be extended to other
queues in future, and:

my $queues_reverse = “webrequest test example_queue”;
if( $queues_reverse =~ /$Ticket->QueueObj->Name/ )

Yay, I got it to work! Although the above wasn’t doing the trick for some
reason, so I tweaked it slightly. Here is what I came up with:

my $queues_to_reverse = “webrequest general”;
my $this_tickets_queue = $Ticket->QueueObj->Name;
if ($queues_to_reverse =~ /$this_tickets_queue/ )
{
$Transactions->OrderBy ( FIELD => ‘id’,
ORDER => ‘DESC’ );
}

Thanks again, Bruce, you da man!
Kendric Beachey

At 11:07 AM 2/13/2002, Bruce Campbell wrote:>On Wed, 13 Feb 2002, Beachey, Kendric wrote:

my $Transactions = $Ticket->Transactions;

if ($Ticket->QueueObj->Name == ‘webrequest’)

‘==’ is a binary numeric comparison, and in the above essentially resolves
to ‘if( 1 == 1 )’. Try instead:

    if( $Ticket->QueueObj->Name =~ /webrequest/i )

Or, if you don’t need the full power of a regular expression (i.e. if you
just want to check for equality), use ‘eq’ - the string equivalent of ‘==’.
if ($Ticket->QueueObj->Name eq ‘webrequest’)

Rick Ford
rickford@ufl.edu
Technical Coordinator, CITT

Bruce Campbell wrote:

did somebody patched the RT2 code (2-0-11) to
show the hostory in a reverse order (means

I think, i have to change
/opt/rt2/WebRT/html/Ticket/Elements/ShowHistory
but i don’t know the internal data structure …

In the above file, you will need to add ordering to the Transactions
variable, so after:

    my $Transactions = $Ticket->Transactions;

add:

    $Transactions->OrderBy( FIELD => 'id',
                            ORDER => 'DESC' );

( default ordering is ASCending )

Cool - Thank you very much !! It works great !

Now turn that into a link to put in the default ticket list page, so that each
person can do this as they are working with rt. :wink:

rob