[rt-users] Correspond Transaction Twice on Reply in Batchmode
Audun Ytterdal
ay at linpro.no
Wed Jan 31 09:28:29 EST 2007
I want to control most of my tickets with mails and I am cc'ing all
tickets in a queue to a group of customers and a shared folder.
Since mail is the main interface i've put some effort into putting some
info in the footer of each mail
<scrip>
Description: 99LinproCorrespond
Condition: On Correspnd
Action: Notify Requestors, Ccs and AdminCcs
Template: Global template: LinproMailTemplateRe
Stage: TransactionCreate
</scrip>
<template>
RT-Attach-Message: yes
Subject: { "Re: [".$RT::rtname." #".$Ticket->id."] ".$Ticket->Subject}
{
my $content = '';
my $transactions = $Ticket->Transactions;
$transactions->Limit( FIELD => 'Type', VALUE => 'Correspond' );
while (my $transaction = $transactions->Next) {
my $attachments = $transaction->Attachments;
while (my $message = $attachments->Next) {
next unless $message->ContentType =~
m!^(text/plain|message|text$)!i;
$content = $message->Content;
}
}
my $output = ($content || $Transaction->Content());
$output;
}
--
Linproticket: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
[{$Ticket->Status}]
Requestor: {$Ticket->RequestorAddresses} Created: {$Ticket->Created}
Owner: {$Ticket->OwnerObj->EmailAddress || $Ticket->OwnerObj->Name}
Level: {$Ticket->FirstCustomFieldValue('LinproLevel') }
</template>
This works, except the script is firing to soon so the information in
$Ticket-Status and friends is outdated.
After some googling around i found out that this works much better if I
put "on correspondece" in "TransactionBatch"-stage. All the information
is now up to date and everything works as expected using the
mailinterface to set Owner and Status and such.
BUT, the script now fires twice If I use the webinterface. When I click
on "reply" on a ticket _and_ when I submit the reply.
If the "on correspondance" is in "TransactionCreate"-Stage: Fire of the
scrip when "update ticket" is clicked. But info is outdated
If the "on correspondance" is in "TransactionBatche"-stage: Fire when
clicking on "reply" and on "update ticket" so I get two mails.
Is there anything I can to the get the benefit of both worlds? Is it a
bug to start a transaction when clicking on reply before you acctually
update it?
--
Audun
More information about the rt-users
mailing list