[rt-users] TransactionBatch scrip got fired twice

2011-09-29 Thread Xin, Qiao
Hi,

I have a scrip to to check when the ticket status changes. If I put it as 
TransactionBatch mode,
each time I change the ticket status, the scrip got fired twice and there will 
be dupllicated emails
sent out. I had to use TransactionBatch, since we want an email notification to 
be sent out when 
either
1.  the user use reply and modify the ticket status
2. modify the ticket status

TransactionBatch works fine when user reply and modify ticket status but got 
duplicated emails when
just change ticket status.

Please advise.

Thanks,
Qiao

RT Training Sessions (http://bestpractical.com/services/training.html)
*  Chicago, IL, USA  September 26 & 27, 2011
*  San Francisco, CA, USA  October 18 & 19, 2011
*  Washington DC, USA  October 31 & November 1, 2011
*  Melbourne VIC, Australia  November 28 & 29, 2011
*  Barcelona, Spain  November 28 & 29, 2011


Re: [rt-users] TransactionBatch scrip got fired twice

2011-09-29 Thread Kevin Falcone
On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
> Hi,
> 
> I have a scrip to to check when the ticket status changes. If I put it as 
> TransactionBatch mode,
> each time I change the ticket status, the scrip got fired twice and there 
> will be dupllicated emails
> sent out. I had to use TransactionBatch, since we want an email notification 
> to be sent out when 
> either
> 1.  the user use reply and modify the ticket status
> 2. modify the ticket status
> 
> TransactionBatch works fine when user reply and modify ticket status but got 
> duplicated emails when
> just change ticket status.

Please show your scrip configuration

-kevin


pgpqA0FihcA2l.pgp
Description: PGP signature

RT Training Sessions (http://bestpractical.com/services/training.html)
*  Chicago, IL, USA — September 26 & 27, 2011
*  San Francisco, CA, USA — October 18 & 19, 2011
*  Washington DC, USA — October 31 & November 1, 2011
*  Melbourne VIC, Australia — November 28 & 29, 2011
*  Barcelona, Spain — November 28 & 29, 2011

Re: [rt-users] TransactionBatch scrip got fired twice

2011-09-29 Thread Daniel Silveira
Hi,
 
I have the exact same problem with a very simple test-only scrip:
 
Condition:  on a transaction
Action: user defined
Stage: TransactionBatch
 
Action code:
$RT::Logger->info($self->TransactionObj->Id);
 
Every transaction generated fires twice this scrip. If I chage the stage to 
TransactionCreate, then it works.
 
Logfile:
[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
Thank you.
Daniel Silveira
On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:>Hi,>>I have a scrip 
to to check when the ticket status changes. If I put it as TransactionBatch 
mode,>each time I change the ticket status, the scrip got fired twice and there 
will be dupllicated emails>sent out. I had to use TransactionBatch, since we 
want an email notification to be sent out when >either>1.  the user use reply 
and modify the ticket status>2. modify the ticket status>>TransactionBatch 
works fine when user reply and modify ticket status but got duplicated emails 
when>just change ticket status.Please show your scrip configuration

-kevin

RT Training Sessions (http://bestpractical.com/services/training.html)
*  San Francisco, CA, USA — October 18 & 19, 2011
*  Washington DC, USA — October 31 & November 1, 2011
*  Melbourne VIC, Australia — November 28 & 29, 2011
*  Barcelona, Spain — November 28 & 29, 2011

Re: [rt-users] TransactionBatch scrip got fired twice

2011-09-29 Thread Kevin Falcone
On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
>Hi,
> 
>I have the exact same problem with a very simple test-only scrip:
> 
>Condition:  on a transaction
>Action: user defined
>Stage: TransactionBatch
> 
>Action code:
>$RT::Logger->info($self->TransactionObj->Id);

There are two action boxes.

Custom action preparation code:
Custom action cleanup code:

Which one did you put the log in.
What did you put in the other one.

-kevin

>Every transaction generated fires twice this scrip. If I chage the stage 
> to TransactionCreate,
>then it works.
> 
>Logfile:
>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
>Thank you.
>Daniel Silveira
> 
>  On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
>  > Hi,
>  >
>  > I have a scrip to to check when the ticket status changes. If I put it as 
> TransactionBatch mode,
>  > each time I change the ticket status, the scrip got fired twice and there 
> will be dupllicated emails
>  > sent out. I had to use TransactionBatch, since we want an email 
> notification to be sent out when
>  > either
>  > 1.  the user use reply and modify the ticket status
>  > 2. modify the ticket status
>  >
>  > TransactionBatch works fine when user reply and modify ticket status but 
> got duplicated emails when
>  > just change ticket status.
> 
>  Please show your scrip configuration
> 
>  -kevin

> 
> RT Training Sessions (http://bestpractical.com/services/training.html)
> *  San Francisco, CA, USA ? October 18 & 19, 2011
> *  Washington DC, USA ? October 31 & November 1, 2011
> *  Melbourne VIC, Australia ? November 28 & 29, 2011
> *  Barcelona, Spain ? November 28 & 29, 2011



pgpKUGjUDevwD.pgp
Description: PGP signature

RT Training Sessions (http://bestpractical.com/services/training.html)
*  San Francisco, CA, USA — October 18 & 19, 2011
*  Washington DC, USA — October 31 & November 1, 2011
*  Melbourne VIC, Australia — November 28 & 29, 2011
*  Barcelona, Spain — November 28 & 29, 2011

Re: [rt-users] TransactionBatch scrip got fired twice

2011-09-30 Thread Daniel Silveira
I tried both action boxes, the same problem happened.
My RT is 4.0.2 fresh install, imported database from RT 3.8.8. 
To add more info, I changed the log a bit. The configuration now is:
 
Condition: on transaction
Action: User Defined
Template: Global template: Blank
Stage: TransactionBatch
 
Custom condition: 
   empty
Custom action preparation code: 
  $RT::Logger->info("Id: ".$self->TransactionObj->Id);
  $RT::Logger->info("Field: ".$self->TransactionObj->Field);
  $RT::Logger->info("Type: ".$self->TransactionObj->Type);
  $RT::Logger->info("NewValue: ".$self->TransactionObj->NewValue );
  return 1;
Custom action cleanup code:
  return 1;
 
The log after changing the Time Worked to 30min:
 
[Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)
[Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)
[Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)
[Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)
[Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)
[Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)
[Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)
[Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)
I noticed that the problem doesn't happen when the scrip is acting upon "on 
comment" condition.
But with other conditions like "On Status Change" and "On Owner Change" the 
problem persists.
If I change the action to "Send Email", which is what i want, the system sends 
2 emails.
 
Thanks in advance.
Daniel Silveira

>>> Kevin Falcone  09/29/11 6:56 pm >>>
On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
>Hi,
> 
>I have the exact same problem with a very simple test-only scrip:
> 
>Condition:  on a transaction
>Action: user defined
>Stage: TransactionBatch
> 
>Action code:
>$RT::Logger->info($self->TransactionObj->Id);

There are two action boxes.

Custom action preparation code:
Custom action cleanup code:

Which one did you put the log in.
What did you put in the other one.

-kevin

>Every transaction generated fires twice this scrip. If I chage the stage 
> to TransactionCreate,
>then it works.
> 
>Logfile:
>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
>Thank you.
>Daniel Silveira
> 
>  On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
>  > Hi,
>  >
>  > I have a scrip to to check when the ticket status changes. If I put it as 
> TransactionBatch mode,
>  > each time I change the ticket status, the scrip got fired twice and there 
> will be dupllicated emails
>  > sent out. I had to use TransactionBatch, since we want an email 
> notification to be sent out when
>  > either
>  > 1.  the user use reply and modify the ticket status
>  > 2. modify the ticket status
>  >
>  > TransactionBatch works fine when user reply and modify ticket status but 
> got duplicated emails when
>  > just change ticket status.
> 
>  Please show your scrip configuration
> 
>  -kevin

> 
> RT Training Sessions (http://bestpractical.com/services/training.html)
> *  San Francisco, CA, USA ? October 18 & 19, 2011
> *  Washington DC, USA ? October 31 & November 1, 2011
> *  Melbourne VIC, Australia ? November 28 & 29, 2011
> *  Barcelona, Spain ? November 28 & 29, 2011


RT Training Sessions (http://bestpractical.com/services/training.html)
*  San Francisco, CA, USA — October 18 & 19, 2011
*  Washington DC, USA — October 31 & November 1, 2011
*  Melbourne VIC, Australia — November 28 & 29, 2011
*  Barcelona, Spain — November 28 & 29, 2011

Re: [rt-users] TransactionBatch scrip got fired twice

2011-09-30 Thread Ruslan Zakirov
Hi,

Add logging into preparation and commit blocks at the same time. It's
expected that preparation stage can be executed several times and
commit code never executed. This is the reason why you shouldn't
change anything in the preparation code.

On Fri, Sep 30, 2011 at 9:09 PM, Daniel Silveira
 wrote:
> I tried both action boxes, the same problem happened.
> My RT is 4.0.2 fresh install, imported database from RT 3.8.8.
> To add more info, I changed the log a bit. The configuration now is:
>
> Condition: on transaction
> Action: User Defined
> Template: Global template: Blank
> Stage: TransactionBatch
>
> Custom condition:
>    empty
> Custom action preparation code:
>   $RT::Logger->info("Id: ".$self->TransactionObj->Id);
>   $RT::Logger->info("Field: ".$self->TransactionObj->Field);
>   $RT::Logger->info("Type: ".$self->TransactionObj->Type);
>   $RT::Logger->info("NewValue: ".$self->TransactionObj->NewValue );
>   return 1;
> Custom action cleanup code:
>   return 1;
>
> The log after changing the Time Worked to 30min:
>
> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)
> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)
> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)
> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)
> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)
> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)
> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)
> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)
> I noticed that the problem doesn't happen when the scrip is acting upon "on
> comment" condition.
> But with other conditions like "On Status Change" and "On Owner Change" the
> problem persists.
> If I change the action to "Send Email", which is what i want, the system
> sends 2 emails.
>
> Thanks in advance.
> Daniel Silveira
 Kevin Falcone  09/29/11 6:56 pm >>>
> On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
>>    Hi,
>>
>>    I have the exact same problem with a very simple test-only scrip:
>>
>>    Condition:  on a transaction
>>    Action: user defined
>>    Stage: TransactionBatch
>>
>>    Action code:
>>    $RT::Logger->info($self->TransactionObj->Id);
>
> There are two action boxes.
>
> Custom action preparation code:
> Custom action cleanup code:
>
> Which one did you put the log in.
> What did you put in the other one.
>
> -kevin
>
>>    Every transaction generated fires twice this scrip. If I chage the
>> stage to TransactionCreate,
>>    then it works.
>>
>>    Logfile:
>>    [Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
>>    [Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
>>    [Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
>>    [Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
>>    Thank you.
>>    Daniel Silveira
>>
>>  On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
>>  > Hi,
>>  >
>>  > I have a scrip to to check when the ticket status changes. If I put it
>> as TransactionBatch mode,
>>  > each time I change the ticket status, the scrip got fired twice and
>> there will be dupllicated emails
>>  > sent out. I had to use TransactionBatch, since we want an email
>> notification to be sent out when
>>  > either
>>  > 1.  the user use reply and modify the ticket status
>>  > 2. modify the ticket status
>>  >
>>  > TransactionBatch works fine when user reply and modify ticket status
>> but got duplicated emails when
>>  > just change ticket status.
>>
>>  Please show your scrip configuration
>>
>>  -kevin
>
>> 
>> RT Training Sessions (http://bestpractical.com/services/training.html)
>> *  San Francisco, CA, USA ? October 18 & 19, 2011
>> *  Washington DC, USA ? October 31 & November 1, 2011
>> *  Melbourne VIC, Australia ? November 28 & 29, 2011
>> *  Barcelona, Spain ? November 28 & 29, 2011
>
>
> 
> RT Training Sessions (http://bestpractical.com/services/training.html)
> *  San Francisco, CA, USA — October 18 & 19, 2011
> *  Washington DC, USA — October 31 & November 1, 2011
> *  Melbourne VIC, Australia — November 28 & 29, 2011
> *  Barcelona, Spain — November 28 & 29, 2011
>



-- 
Best regards, Ruslan.

RT Training Sessions (http://bestpractical.com/services/training.html)
*  San Francisco, CA, USA  October 18 & 19, 2011
*  Washington DC, USA  October 31 & November 1, 2011
*  Melbourne VIC, Australia  November 28 & 29, 2011
*  Barcelona, Spain  November 28 & 29, 2011

Re: [rt-users] TransactionBatch scrip got fired twice

2011-10-04 Thread Daniel Silveira
Ok.
Put the log on both boxes. Preparation and Commit (clean-up):
 
Condition: on transaction
Action: User Defined
Template: Global template: Blank
Stage: TransactionBatch
Custom condition:
   empty
Custom action preparation code:
$RT::Logger->info("Preparation-box - Id:
".$self->TransactionObj->Id);
return 1;
Custom action cleanup code:
$RT::Logger->info("Commit-box - Id: ".$self->TransactionObj->Id);
return 1;
 
 
The log shows:
[Tue Oct  4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval
1629):1)
[Tue Oct  4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval
1635):1)
[Tue Oct  4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval
1641):1)
[Tue Oct  4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval
1647):1)
It doesn't happen with "On Comment" or "On correspond". Only "On
transaction".
Any sugestion?
What could be wrong?
Daniel Silveira

>>> Ruslan Zakirov  09/30/11 7:16 pm >>>
Hi,

Add logging into preparation and commit blocks at the same time. It's
expected that preparation stage can be executed several times and
commit code never executed. This is the reason why you shouldn't
change anything in the preparation code.

On Fri, Sep 30, 2011 at 9:09 PM, Daniel Silveira
 wrote:
> I tried both action boxes, the same problem happened.
> My RT is 4.0.2 fresh install, imported database from RT 3.8.8.
> To add more info, I changed the log a bit. The configuration now is:
>
> Condition: on transaction
> Action: User Defined
> Template: Global template: Blank
> Stage: TransactionBatch
>
> Custom condition:
>empty
> Custom action preparation code:
>   $RT::Logger->info("Id: ".$self->TransactionObj->Id);
>   $RT::Logger->info("Field: ".$self->TransactionObj->Field);
>   $RT::Logger->info("Type: ".$self->TransactionObj->Type);
>   $RT::Logger->info("NewValue: ".$self->TransactionObj->NewValue
);
>   return 1;
> Custom action cleanup code:
>   return 1;
>
> The log after changing the Time Worked to 30min:
>
> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)
> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)
> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)
> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)
> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)
> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)
> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)
> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)
> I noticed that the problem doesn't happen when the scrip is acting
upon "on
> comment" condition.
> But with other conditions like "On Status Change" and "On Owner
Change" the
> problem persists.
> If I change the action to "Send Email", which is what i want, the
system
> sends 2 emails.
>
> Thanks in advance.
> Daniel Silveira
 Kevin Falcone  09/29/11 6:56 pm >>>
> On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
>>Hi,
>>
>>I have the exact same problem with a very simple test-only
scrip:
>>
>>Condition:  on a transaction
>>Action: user defined
>>Stage: TransactionBatch
>>
>>Action code:
>>$RT::Logger->info($self->TransactionObj->Id);
>
> There are two action boxes.
>
> Custom action preparation code:
> Custom action cleanup code:
>
> Which one did you put the log in.
> What did you put in the other one.
>
> -kevin
>
>>Every transaction generated fires twice this scrip. If I chage
the
>> stage to TransactionCreate,
>>then it works.
>>
>>Logfile:
>>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
>>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
>>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
>>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
>>Thank you.
>>Daniel Silveira
>>
>>  On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
>>  > Hi,
>>  >
>>  > I have a scrip to to check when the ticket status changes. If I
put it
>> as TransactionBatch mode,
>>  > each time I change the ticket status, the scrip got fired twice
and
>> there will be dupllicated emails
>>  > sent out. I had to use TransactionBatch, since we want an email
>> notification to be sent out when
>>  > either
>>  > 1.  the user use reply and modify the ticket status
>>  > 2. modify the ticket status
>>  >
>>  > TransactionBatch works fine when user reply and modify ticket
status
>> but got duplicated emails when
>>  > just change ticket status.
>>
>>  Please show your scrip configuration
>>
>>  -kevin
>
>> 
>> RT Training Sessions
(http://bestpractical.com/services/training.html)
>> *  San Francisco, CA, USA ? October 18 & 19, 2011
>> *  Washington DC, USA ? October 31 & November 1, 2011
>> *  Melbourne VIC, Australia ? November 28 & 29, 2011
>> *  Barcelona, Spain ? November 28 & 29, 2011
>
>
> 
> RT Training Sessions
(http://bestpractical.com/services/training.html)
> *  San Francisco, CA, USA — October 18 & 1

Re: [rt-users] TransactionBatch scrip got fired twice

2011-10-04 Thread Kevin Falcone
Have a look at
http://issues.bestpractical.com/Ticket/Display.html?id=18426

-kevin

On Tue, Oct 04, 2011 at 01:32:48PM -0300, Daniel Silveira wrote:
>Ok.
>Put the log on both boxes. Preparation and Commit (clean-up):
> 
>Condition: on transaction
>Action: User Defined
>Template: Global template: Blank
>Stage: TransactionBatch
>Custom condition:
>   empty
>Custom action preparation code:
>$RT::Logger->info("Preparation-box - Id: ".$self->TransactionObj->Id);
>return 1;
>Custom action cleanup code:
>$RT::Logger->info("Commit-box - Id: ".$self->TransactionObj->Id);
>return 1;
> 
> 
>The log shows:
>[Tue Oct  4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval 
> 1629):1)
>[Tue Oct  4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 1635):1)
>[Tue Oct  4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval 
> 1641):1)
>[Tue Oct  4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 1647):1)
>It doesn't happen with "On Comment" or "On correspond". Only "On 
> transaction".
>Any sugestion?
>What could be wrong?
>Daniel Silveira
>>>> Ruslan Zakirov  09/30/11 7:16 pm >>>
>Hi,
> 
>Add logging into preparation and commit blocks at the same time. It's
>expected that preparation stage can be executed several times and
>commit code never executed. This is the reason why you shouldn't
>change anything in the preparation code.
> 
>On Fri, Sep 30, 2011 at 9:09 PM, Daniel Silveira
> wrote:
>> I tried both action boxes, the same problem happened.
>> My RT is 4.0.2 fresh install, imported database from RT 3.8.8.
>> To add more info, I changed the log a bit. The configuration now is:
>>
>> Condition: on transaction
>> Action: User Defined
>> Template: Global template: Blank
>> Stage: TransactionBatch
>>
>> Custom condition:
>>empty
>> Custom action preparation code:
>>   $RT::Logger->info("Id: ".$self->TransactionObj->Id);
>>   $RT::Logger->info("Field: ".$self->TransactionObj->Field);
>>   $RT::Logger->info("Type: ".$self->TransactionObj->Type);
>>   $RT::Logger->info("NewValue: ".$self->TransactionObj->NewValue );
>>   return 1;
>> Custom action cleanup code:
>>   return 1;
>>
>> The log after changing the Time Worked to 30min:
>>
>> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)
>> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)
>> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)
>> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)
>> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)
>> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)
>> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)
>> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)
>> I noticed that the problem doesn't happen when the scrip is acting upon 
> "on
>> comment" condition.
>> But with other conditions like "On Status Change" and "On Owner Change" 
> the
>> problem persists.
>> If I change the action to "Send Email", which is what i want, the system
>> sends 2 emails.
>>
>> Thanks in advance.
>> Daniel Silveira
> Kevin Falcone  09/29/11 6:56 pm >>>
>> On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
>>>Hi,
>>>
>>>I have the exact same problem with a very simple test-only scrip:
>>>
>>>Condition:  on a transaction
>>>Action: user defined
>>>Stage: TransactionBatch
>>>
>>>Action code:
>>>$RT::Logger->info($self->TransactionObj->Id);
>>
>> There are two action boxes.
>>
>> Custom action preparation code:
>> Custom action cleanup code:
>>
>> Which one did you put the log in.
>> What did you put in the other one.
>>
>> -kevin
>>
>>>Every transaction generated fires twice this scrip. If I chage the
>>> stage to TransactionCreate,
>>>then it works.
>>>
>>>Logfile:
>>>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
>>>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
>>>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
>>>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
>>>Thank you.
>>>Daniel Silveira
>>>
>>>  On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
>>>  > Hi,
>>>  >
>>>  > I have a scrip to to check when the ticket status changes. If I put 
> it
>>> as TransactionBatch mode,
>>>  > each time I change the ticket status, the scrip got fired twice and
>>> there will be dupllicated emails
>>>  > sent out. I had to use TransactionBatch, since we want an email
>>> notification to be sent out when
>

Re: [rt-users] TransactionBatch scrip got fired twice

2011-10-05 Thread Daniel Silveira
Thank you, Kevin.
Do you suggest any workaround for this?

>>> Kevin Falcone  10/04/11 2:23 pm >>>
Have a look at
http://issues.bestpractical.com/Ticket/Display.html?id=18426 

-kevin

On Tue, Oct 04, 2011 at 01:32:48PM -0300, Daniel Silveira wrote:
>Ok.
>Put the log on both boxes. Preparation and Commit (clean-up):
> 
>Condition: on transaction
>Action: User Defined
>Template: Global template: Blank
>Stage: TransactionBatch
>Custom condition:
>   empty
>Custom action preparation code:
>$RT::Logger->info("Preparation-box - Id: ".$self->TransactionObj->Id);
>return 1;
>Custom action cleanup code:
>$RT::Logger->info("Commit-box - Id: ".$self->TransactionObj->Id);
>return 1;
> 
> 
>The log shows:
>[Tue Oct  4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval 
> 1629):1)
>[Tue Oct  4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 1635):1)
>[Tue Oct  4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval 
> 1641):1)
>[Tue Oct  4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 1647):1)
>It doesn't happen with "On Comment" or "On correspond". Only "On 
> transaction".
>Any sugestion?
>What could be wrong?
>Daniel Silveira
>>>> Ruslan Zakirov  09/30/11 7:16 pm >>>
>Hi,
> 
>Add logging into preparation and commit blocks at the same time. It's
>expected that preparation stage can be executed several times and
>commit code never executed. This is the reason why you shouldn't
>change anything in the preparation code.
> 
>On Fri, Sep 30, 2011 at 9:09 PM, Daniel Silveira
> wrote:
>> I tried both action boxes, the same problem happened.
>> My RT is 4.0.2 fresh install, imported database from RT 3.8.8.
>> To add more info, I changed the log a bit. The configuration now is:
>>
>> Condition: on transaction
>> Action: User Defined
>> Template: Global template: Blank
>> Stage: TransactionBatch
>>
>> Custom condition:
>>empty
>> Custom action preparation code:
>>   $RT::Logger->info("Id: ".$self->TransactionObj->Id);
>>   $RT::Logger->info("Field: ".$self->TransactionObj->Field);
>>   $RT::Logger->info("Type: ".$self->TransactionObj->Type);
>>   $RT::Logger->info("NewValue: ".$self->TransactionObj->NewValue );
>>   return 1;
>> Custom action cleanup code:
>>   return 1;
>>
>> The log after changing the Time Worked to 30min:
>>
>> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)
>> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)
>> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)
>> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)
>> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)
>> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)
>> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)
>> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)
>> I noticed that the problem doesn't happen when the scrip is acting upon 
> "on
>> comment" condition.
>> But with other conditions like "On Status Change" and "On Owner Change" 
> the
>> problem persists.
>> If I change the action to "Send Email", which is what i want, the system
>> sends 2 emails.
>>
>> Thanks in advance.
>> Daniel Silveira
> Kevin Falcone  09/29/11 6:56 pm >>>
>> On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
>>>Hi,
>>>
>>>I have the exact same problem with a very simple test-only scrip:
>>>
>>>Condition:  on a transaction
>>>Action: user defined
>>>Stage: TransactionBatch
>>>
>>>Action code:
>>>$RT::Logger->info($self->TransactionObj->Id);
>>
>> There are two action boxes.
>>
>> Custom action preparation code:
>> Custom action cleanup code:
>>
>> Which one did you put the log in.
>> What did you put in the other one.
>>
>> -kevin
>>
>>>Every transaction generated fires twice this scrip. If I chage the
>>> stage to TransactionCreate,
>>>then it works.
>>>
>>>Logfile:
>>>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)
>>>[Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)
>>>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)
>>>[Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)
>>>Thank you.
>>>Daniel Silveira
>>>
>>>  On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:
>>>  > Hi,
>>>  >
>>>  > I have a scrip to to check when the ticket status changes. If I put 
> it
>>> as TransactionBatch mode,
>>>  > each time I change the ticket status, the scrip got fired twice and
>>> there will be dupllicated emails
>>>  > sent o

Re: [rt-users] TransactionBatch scrip got fired twice

2011-10-05 Thread Kevin Falcone
On Wed, Oct 05, 2011 at 02:44:41PM -0300, Daniel Silveira wrote:
>Thank you, Kevin.
>Do you suggest any workaround for this?

Don't use TransactionBatch until a patch has been produced or write a
clever Prepare or Condition that skips the second run.

-kevin

>>>> Kevin Falcone  10/04/11 2:23 pm >>>
>Have a look at
>[1]http://issues.bestpractical.com/Ticket/Display.html?id=18426
> 
>-kevin
> 
>On Tue, Oct 04, 2011 at 01:32:48PM -0300, Daniel Silveira wrote:
>>Ok.
>>Put the log on both boxes. Preparation and Commit (clean-up):
>>
>>Condition: on transaction
>>Action: User Defined
>>Template: Global template: Blank
>>Stage: TransactionBatch
>>Custom condition:
>>   empty
>>Custom action preparation code:
>>$RT::Logger->info("Preparation-box - Id: 
> ".$self->TransactionObj->Id);
>>return 1;
>>Custom action cleanup code:
>>$RT::Logger->info("Commit-box - Id: ".$self->TransactionObj->Id);
>>return 1;
>>
>>
>>The log shows:
>>[Tue Oct  4 16:27:24 2011] [info]: Preparation-box - Id: 323773 
> ((eval 1629):1)
>>[Tue Oct  4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 
> 1635):1)
>>[Tue Oct  4 16:27:24 2011] [info]: Preparation-box - Id: 323773 
> ((eval 1641):1)
>>[Tue Oct  4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 
> 1647):1)
>>It doesn't happen with "On Comment" or "On correspond". Only "On 
> transaction".
>>Any sugestion?
>>What could be wrong?
>>Daniel Silveira
>>>>> Ruslan Zakirov  09/30/11 7:16 pm >>>
>>Hi,
>>
>>Add logging into preparation and commit blocks at the same time. It's
>>expected that preparation stage can be executed several times and
>>commit code never executed. This is the reason why you shouldn't
>>change anything in the preparation code.
>>
>>On Fri, Sep 30, 2011 at 9:09 PM, Daniel Silveira
>> wrote:
>>> I tried both action boxes, the same problem happened.
>>> My RT is 4.0.2 fresh install, imported database from RT 3.8.8.
>>> To add more info, I changed the log a bit. The configuration now is:
>>>
>>> Condition: on transaction
>>> Action: User Defined
>>> Template: Global template: Blank
>>> Stage: TransactionBatch
>>>
>>> Custom condition:
>>>empty
>>> Custom action preparation code:
>>>   $RT::Logger->info("Id: ".$self->TransactionObj->Id);
>>>   $RT::Logger->info("Field: ".$self->TransactionObj->Field);
>>>   $RT::Logger->info("Type: ".$self->TransactionObj->Type);
>>>   $RT::Logger->info("NewValue: 
> ".$self->TransactionObj->NewValue );
>>>   return 1;
>>> Custom action cleanup code:
>>>   return 1;
>>>
>>> The log after changing the Time Worked to 30min:
>>>
>>> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)
>>> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)
>>> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)
>>> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)
>>> [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)
>>> [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)
>>> [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)
>>> [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)
>>> I noticed that the problem doesn't happen when the scrip is acting 
> upon "on
>>> comment" condition.
>>> But with other conditions like "On Status Change" and "On Owner 
> Change" the
>>> problem persists.
>>> If I change the action to "Send Email", which is what i want, the 
> system
>>> sends 2 emails.
>>>
>>> Thanks in advance.
>>> Daniel Silveira
>> Kevin Falcone  09/29/11 6:56 pm >>>
>>> On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:
>>>>Hi,
>>>>
>>>>I have the exact same problem with a very simple test-only 
> scrip:
>>>>
>>>>Condition:  on a transaction
>>>>Action: user defined
>>>>Stage: TransactionBatch
>>>>
>>>>Action code:
>>>>$RT::Logger->info($self->TransactionObj->Id);
>>>
>>> There are two action boxes.
>>>
>>> Custom action preparation code:
>>> Custom action cleanup code:
>>>
>>> Which one did you put the log in.
>>> What did you put in the other one.
>>>
>>> -kevin
>>>
>>>>Every transaction generated fires twice this scrip. If I chage 
> the
>>>> stage to 

Re: [rt-users] TransactionBatch scrip got fired twice

2012-01-02 Thread Gerard FENELON

Hi

was the fix for this included in 3.8.11 ?

According to http://issues.bestpractical.com
#17201: RT 3.8.11 release (not resolved BTW) depends on #18426

but I just moved to 3.8.11 and the issue still seems to be there.
The choice is between sending 2 emails or sending one with stale CF values :-(

Thanks
Gerard



On 2011-10-05 22:38, Kevin Falcone wrote:

On Wed, Oct 05, 2011 at 02:44:41PM -0300, Daniel Silveira wrote:

Thank you, Kevin.
Do you suggest any workaround for this?

Don't use TransactionBatch until a patch has been produced or write a
clever Prepare or Condition that skips the second run.

-kevin


>>>  Kevin Falcone  10/04/11 2:23 pm>>>
Have a look at
[1]http://issues.bestpractical.com/Ticket/Display.html?id=18426

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)
* Boston  March 5 & 6, 2012


Re: [rt-users] TransactionBatch scrip got fired twice

2012-01-03 Thread Kevin Falcone
On Mon, Jan 02, 2012 at 04:14:19PM +0100, Gerard FENELON wrote:
> was the fix for this included in 3.8.11 ?

No, it was in 4.0.4, but is not in 3.8.11.
I believe it has finally been merged to 3.8-trunk so would be in a
future 3.8 release.

-kevin

> According to http://issues.bestpractical.com
> #17201: RT 3.8.11 release (not resolved BTW) depends on #18426
> 
> but I just moved to 3.8.11 and the issue still seems to be there.
> The choice is between sending 2 emails or sending one with stale CF values :-(
> 
> Thanks
> Gerard
> 
> 
> 
> On 2011-10-05 22:38, Kevin Falcone wrote:
> >On Wed, Oct 05, 2011 at 02:44:41PM -0300, Daniel Silveira wrote:
> >>Thank you, Kevin.
> >>Do you suggest any workaround for this?
> >Don't use TransactionBatch until a patch has been produced or write a
> >clever Prepare or Condition that skips the second run.
> >
> >-kevin
> >
> >>>>>  Kevin Falcone  10/04/11 2:23 pm>>>
> >>Have a look at
> >>[1]http://issues.bestpractical.com/Ticket/Display.html?id=18426
> >>
> >>-kevin
> 
> RT Training Sessions (http://bestpractical.com/services/training.html)
> * Boston  March 5 & 6, 2012


pgpQBG4bZPTvN.pgp
Description: PGP signature

RT Training Sessions (http://bestpractical.com/services/training.html)
* Boston — March 5 & 6, 2012