[rt-users] Ticket Body in Email
Stefan Seiz
TalkLists at index-s.de
Sat Dec 13 11:37:52 EST 2003
On 13.12.2003 5:21 Uhr, jflanders at burrelles.com <jflanders at burrelles.com>
wrote:
> I've just got 2 more small hurdles to clear before I should have a
> working RT for my company. The way we want to use RT is when a new
> ticket comes in our supervisor assigns it to a technician by changing
> the owner. The technician would get an email notifying him/her of the
> ticket including details of the ticket. One of which I'd like to be the
> actual body of the ticket or history but the {$Transaction->Content()}
> doesn't work in Change Owner. Is there another way to get it put the
> body of the ticket in an email? Or has this been fixed in 3.0.7?
I guess, this is as $Transaction->Content() refers to the CURRENT
Transaction which is the OwnerChange.
I needed the same and came up with using the following Template (bits and
pieces stolen from templ. others posted. Note! i reverse sort tickets on my
rt -> newest on top, thus GotoFirstItem will actually do the opposite of
what you'd think it does - for me at least.).
The template should list the whole ticket history for transactions of type
CORRESPOND.
Template Content (watch for wrong linewraps due to emailing this):
RT-Attach-Message: yes
Ticket history (latest emails on top):
{
my $resolved_transaction;
my $resolved_message = "";
my $last_content;
my $Transactions = $Ticket->Transactions;
$Transactions->OrderBy( FIELD => 'id', ORDER => 'DESC' );
$Transactions->GotoFirstItem;
while (my $Transaction = $Transactions->Next) {
if ($Transaction->Type eq 'Correspond') {
$resolved_transaction = $Transaction;
} elsif (!$Transactions->IsLast) {
$resolved_transaction = undef;
}
if ($resolved_transaction) {
my $attachments = $resolved_transaction->Attachments;
$attachments->GotoFirstItem;
while (my $message = $attachments->Next) {
next unless $message->ContentType =~
m!^(text/plain|message|text$)!i;
my $content = $message->Content;
if ($last_content eq $content) {
$content = undef; }
next unless length $content;
$last_content = $content;
my $subject = ($message->Subject || $Ticket->Subject);
my $wrapper = Text::Wrapper->new(columns=>70);
$content = $wrapper->wrap($content);
$resolved_message .= "Subject: ";
$resolved_message .= $subject;
$resolved_message .= "\n";
$resolved_message .= "From: ";
$resolved_message .= $message->CreatorObj->RealName ."
(".$rtname.")";
$resolved_message .= "\n";
$resolved_message .= "Time: ";
$resolved_message .= $message->CreatedObj->AsString;
$resolved_message .= "\n";
$resolved_message .= "\n";
$resolved_message .= "$content\n\n";
$resolved_message .=
"------------------------------------------------\n";
}
}
}
$resolved_message;
}
--
{$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
--
Stefan Seiz <http://www.stefanseiz.com>
Spamto: <bin at imd.net>
More information about the rt-users
mailing list