[rt-users] Re: Resolve Ticket Template

Bruce Campbell bruce_campbell at ripe.net
Thu Jul 25 16:13:32 EDT 2002


On Thu, 25 Jul 2002, Wolfgang W. Baumann wrote:

> I like to also include the final comment made by the person resolving
> the ticket.

This may or may not work for you (as one line):

{ my $have_last=0; my $retval = undef; my $newtrans=$Ticket->Transactions;
  $newtrans->OrderBy( FIELD => 'id', ORDER => 'DESC' ); while( my
  $thistrans = $newtrans->Next && $have_last == 0 ){ next unless(
  $thistrans->Type eq 'Correspond' );  $have_last++;
  $retval=$thistrans->Content unless( defined( $retval ) ); } $retval; }

( Grab the transactions, reverse the ordering, step through until we find
  an instance of correspondence, return the first (really the last) one
  found. Never ever return Comments to the punters. )

> Or, how do I enforce the sequence of transactions recorded (first the
> status change then the correspondence)?

I think the WebUI is committing the correspondence before the status
change, but the default ordering in Transactions.pm is by 'Created'.  This
may mean that MySQL is not giving the rows in a known order if two rows
have the same 'created' value.

Hence, adding an additional OrderBy clause in _Init() of Transactions.pm
to sort on id, ascending may fix your problem.

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





More information about the rt-users mailing list