[rt-users] Displaying Comments in Templates

Andy Harrison ah30 at harrisonfamily.com
Thu Mar 4 13:38:13 EST 2004


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Thu, 4 Mar 2004 10:37:59 -0500, Andy Harrison wrote
Subject: "Re: [rt-users] Displaying Comments in Templates"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>  I'm trying this snippet to get the last comment on a ticket.  It
>  doesn't display any errors, but the between the --- dashes is blank in
>  the e-mail.
> 
> 
>  Template Content:
> 
>   last comment:
>   ---
>   {
>     my $resolution_comment;
>     my $Transactions = $Ticket->Transactions;
>     $Transactions->OrderBy( FIELD => 'id', ORDER => 'DESC' );
>     $Transactions->GotoFirstItem;
>     while (my $Transaction = $Transactions->Next) {
>       if ($Transaction->Type eq 'Correspond') {
>         $resolution_comment = $Transaction->First->Content;
>         last;
>       }
>     }
>     $OUT .= $resolution_comment;
>     $OUT;
>   }
>   ---

I tried simplifying it and shortening it to:

{
  $Ticket->Transactions->OrderBy( FIELD => 'id', ORDER => 'DESC' );
  $Ticket->Transactions->GotoFirstItem;
  $Ticket->Transactions->First->Content();
}


But that doesn't cut it.   $Ticket->Transactions->First->Content();
still shows the real first comment;

Any ideas?

-- 
Andy Harrison
(full headers for details)



More information about the rt-users mailing list