[rt-users] Reply with all comments in history.....

darren chamberlain darren at boston.com
Tue Aug 20 09:37:44 EDT 2002


* Patrick Harlin <pathar at dc.luth.se> [2002-08-20 05:43]:
> I wonder if anyone have a clue how to send a reply containing all of
> the comments in the hostory of the ticket ?

Getting all the transactions for a ticket is pretty simple; take a look
at ShowHistory and ShowTransaction in WebRT/html/Tickets/Elements to get
started.  This will list all comments attached to ticket $Id:

 (my $Ticket = RT::Ticket->new($session{'CurrentUser'}))->Load($Id);
  my $Transactions = $Ticket->Transactions

  while (my $Transaction = $Transactions->Next) {
      next unless $Transaction->Type eq 'Comment';

      printf "Subject: %s", $Transaction->Subject;

      my $Attachments = $Transaction->Attachments;
      $Attachments->GotoFirstItem;

      while (my $attachment = $Attachments->Next) {
          printf "Content:\n%s\n", $attachment->Content;
      }

      print "\n";   # separator, for good measure.
  }

Wrap that in the appropriate markup, and you've got a list of comments
on a ticket.

(darren)

-- 
OCCAM'S ERASER:
The philosophical principle that even the simplest solution is bound
to have something wrong with it.




More information about the rt-users mailing list