[rt-users] Displaying Comments in Templates

Andy Harrison ah30 at harrisonfamily.com
Thu Mar 4 10:37:59 EST 2004


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Wed, 3 Mar 2004 11:21:35 -0500, Andy Harrison wrote
Subject: "[rt-users] Displaying Comments in Templates"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> {$Ticket->Transactions->First->Content()} displays the first comment
> of a ticket in a template.  Is there a way to get it to display the
> last one?
> 
> -- 
> Andy Harrison
> (full headers for details)


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;
 }
 ---

-- 
Andy Harrison
(full headers for details)




More information about the rt-users mailing list