Correspond Transaction Twice on Reply in Batchmode

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

Description: 99LinproCorrespond Condition: On Correspnd Action: Notify Requestors, Ccs and AdminCcs Template: Global template: LinproMailTemplateRe Stage: TransactionCreate RT-Attach-Message: yes

{
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’) }

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

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

Description: 99LinproCorrespond Condition: On Correspnd Action: Notify Requestors, Ccs and AdminCcs Template: Global template: LinproMailTemplateRe Stage: TransactionCreate RT-Attach-Message: yes

{
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’) }

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

Try this patchOn 1/31/07, Audun Ytterdal ay@linpro.no wrote:

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

Description: 99LinproCorrespond Condition: On Correspnd Action: Notify Requestors, Ccs and AdminCcs Template: Global template: LinproMailTemplateRe Stage: TransactionCreate 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’) }

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

Best regards, Ruslan.

rt-3.6.3-transaction_batch.patch (899 Bytes)