[rt-users] NotifyOwner and NotifyOwnerAsComment

Seth Cohn, EFN General Manager gm at efn.org
Thu Jan 16 21:51:54 EST 2003


On Thu, 16 Jan 2003, Rafael Maximo wrote:

> >You could work around this by installing OnOwnerChange from the
> >contrib area, and doing an OnOwnerChange NotifyOwner.
> 
> It worked but not in the way a wanted. I want the new owner to receive the 
> comment or the reply. Let me explain what happen here, The RT receives the 
> new ticket and then a read and click on comment, write the comment and set 
> the owner responsible to answer that ticket, but a want the new owner to 
> receive the comment in his e-mail. With your suggestion the owner is being 
> notified but he doesn't receive the comment.

You want to modify the template to send the old comment, not just the
current transaction.  (ie {$Transaction->Content()} )

See below for one example template... this doesn't show actions, such as
who reassigned to who, if someone wants to modify it, please share the
improved code with me (and all of us).


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

Greetings, this ticket is now yours.

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

{$Ticket->Transactions->First->Content()}

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

{
  my $this_transaction;
  my $complete_message = "";
  my $Transactions = $Ticket->Transactions;
  $Transactions->OrderBy;
  $Transactions->GotoFirstItem;
  while (my $Transaction = $Transactions->Next) {
       if (!$Transactions->IsLast) {      
      $this_transaction = undef;
       }


  if ($this_transaction) {
    
    my $attachments = $this_transaction->Attachments;
    $attachments->GotoFirstItem;

    while (my $message = $attachments->Next) {
      next unless $message->ContentType =~
	m!^(text/plain|message|text$)!i;

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

  $complete_message;
}






More information about the rt-users mailing list