Contrib: GiveHistory template Re: [rt-users] NotifyOwner and NotifyOwnerAsComment

Seth Cohn, EFN General Manager gm at
Thu Jan 16 23:26:08 EST 2003

One MORE correction.  Bleh. 

I'd modified this template and halfway tested it, but didn't notice that
I'd goofed.  The original version of this template was for resolved
tickets, and was sent to the end user, so it stripped out everything but
correspondence. This version was for sending to the new owner, so I wanted
comments sent.  But I messed up the if/elsif lines, and never noticed
that.  Please excuse my error(s).

Use the following, which works, which I've tested fully now.
I'd love to see the code that would process the non-message transactions
properly, if anyone does take the time to write that.

Subject: Ticket Reassigned: {$Ticket->Subject}

Greetings, this ticket is now yours.

       Queue: {$Ticket->QueueObj->Name}
  Requestors: {$Ticket->Requestors->EmailsAsString()}
      Status: {$Ticket->Status}
 Ticket <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >

--- The initial request was ------------------------------------


--- Additional activity ----------------------------------------

  my $this_transaction;
  my $complete_message = "";
  my $Transactions = $Ticket->Transactions;
  while (my $Transaction = $Transactions->Next) {
    $this_transaction = $Transaction;
    if ($this_transaction) {
      my $attachments = $this_transaction->Attachments;

      while (my $message = $attachments->Next) {
        next unless $message->ContentType =~

        my $content = $message->Content;
        next unless length $content;

        my $subject = ($message->Subject || $Ticket->Subject);

        my $wrapper = Text::Wrapper->new(columns=>70);
        $content = $wrapper->wrap($content);

        $complete_message .= "Subject: ";
        $complete_message .= $subject;
        $complete_message .= "\n";
        $complete_message .= "From: ";
        $complete_message .= $message->CreatorObj->RealName;
        $complete_message .= "\n";
        $complete_message .= "Time: ";
        $complete_message .= $message->CreatedObj->AsString;
        $complete_message .= "\n";
        $complete_message .= "\n";
        $complete_message .= "$content\n";
        $complete_message .= "--------------------------\n";



More information about the rt-users mailing list