<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16430"></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Segoe UI">
<DIV>Thank you, Kevin.</DIV>
<DIV>Do you suggest any workaround for this?<BR><BR>>>> Kevin Falcone <falcone@bestpractical.com> 10/04/11 2:23 pm >>><BR>Have a look at<BR><A href="http://issues.bestpractical.com/Ticket/Display.html?id=18426">http://issues.bestpractical.com/Ticket/Display.html?id=18426</A><BR><BR>-kevin<BR><BR>On Tue, Oct 04, 2011 at 01:32:48PM -0300, Daniel Silveira wrote:<BR>> Ok.<BR>> Put the log on both boxes. Preparation and Commit (clean-up):<BR>> <BR>> Condition: on transaction<BR>> Action: User Defined<BR>> Template: Global template: Blank<BR>> Stage: TransactionBatch<BR>> Custom condition:<BR>> empty<BR>> Custom action preparation code:<BR>> $RT::Logger->info("Preparation-box - Id: ".$self->TransactionObj->Id);<BR>> return 1;<BR>> Custom action cleanup code:<BR>> $RT::Logger->info("Commit-box - Id: ".$self->TransactionObj->Id);<BR>> return 1;<BR>> <BR>> <BR>> The log shows:<BR>> [Tue Oct 4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval 1629):1)<BR>> [Tue Oct 4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 1635):1)<BR>> [Tue Oct 4 16:27:24 2011] [info]: Preparation-box - Id: 323773 ((eval 1641):1)<BR>> [Tue Oct 4 16:27:24 2011] [info]: Commit-box - Id: 323773 ((eval 1647):1)<BR>> It doesn't happen with "On Comment" or "On correspond". Only "On transaction".<BR>> Any sugestion?<BR>> What could be wrong?<BR>> Daniel Silveira<BR>> >>> Ruslan Zakirov <ruz@bestpractical.com> 09/30/11 7:16 pm >>><BR>> Hi,<BR>> <BR>> Add logging into preparation and commit blocks at the same time. It's<BR>> expected that preparation stage can be executed several times and<BR>> commit code never executed. This is the reason why you shouldn't<BR>> change anything in the preparation code.<BR>> <BR>> On Fri, Sep 30, 2011 at 9:09 PM, Daniel Silveira<BR>> <DSilveira@prmg.mpf.gov.br> wrote:<BR>> > I tried both action boxes, the same problem happened.<BR>> > My RT is 4.0.2 fresh install, imported database from RT 3.8.8.<BR>> > To add more info, I changed the log a bit. The configuration now is:<BR>> ><BR>> > Condition: on transaction<BR>> > Action: User Defined<BR>> > Template: Global template: Blank<BR>> > Stage: TransactionBatch<BR>> ><BR>> > Custom condition:<BR>> > empty<BR>> > Custom action preparation code:<BR>> > $RT::Logger->info("Id: ".$self->TransactionObj->Id);<BR>> > $RT::Logger->info("Field: ".$self->TransactionObj->Field);<BR>> > $RT::Logger->info("Type: ".$self->TransactionObj->Type);<BR>> > $RT::Logger->info("NewValue: ".$self->TransactionObj->NewValue );<BR>> > return 1;<BR>> > Custom action cleanup code:<BR>> > return 1;<BR>> ><BR>> > The log after changing the Time Worked to 30min:<BR>> ><BR>> > [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1836):1)<BR>> > [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1836):2)<BR>> > [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1836):3)<BR>> > [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1836):4)<BR>> > [Fri Sep 30 16:58:08 2011] [info]: Id: 323754 ((eval 1854):1)<BR>> > [Fri Sep 30 16:58:08 2011] [info]: Field: TimeWorked ((eval 1854):2)<BR>> > [Fri Sep 30 16:58:08 2011] [info]: Type: Set ((eval 1854):3)<BR>> > [Fri Sep 30 16:58:08 2011] [info]: NewValue: 30 ((eval 1854):4)<BR>> > I noticed that the problem doesn't happen when the scrip is acting upon "on<BR>> > comment" condition.<BR>> > But with other conditions like "On Status Change" and "On Owner Change" the<BR>> > problem persists.<BR>> > If I change the action to "Send Email", which is what i want, the system<BR>> > sends 2 emails.<BR>> ><BR>> > Thanks in advance.<BR>> > Daniel Silveira<BR>> >>>> Kevin Falcone <falcone@bestpractical.com> 09/29/11 6:56 pm >>><BR>> > On Thu, Sep 29, 2011 at 06:39:03PM -0300, Daniel Silveira wrote:<BR>> >> Hi,<BR>> >><BR>> >> I have the exact same problem with a very simple test-only scrip:<BR>> >><BR>> >> Condition: on a transaction<BR>> >> Action: user defined<BR>> >> Stage: TransactionBatch<BR>> >><BR>> >> Action code:<BR>> >> $RT::Logger->info($self->TransactionObj->Id);<BR>> ><BR>> > There are two action boxes.<BR>> ><BR>> > Custom action preparation code:<BR>> > Custom action cleanup code:<BR>> ><BR>> > Which one did you put the log in.<BR>> > What did you put in the other one.<BR>> ><BR>> > -kevin<BR>> ><BR>> >> Every transaction generated fires twice this scrip. If I chage the<BR>> >> stage to TransactionCreate,<BR>> >> then it works.<BR>> >><BR>> >> Logfile:<BR>> >> [Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1558):1)<BR>> >> [Thu Sep 29 19:12:47 2011] [info]: 323732 ((eval 1566):1)<BR>> >> [Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1582):1)<BR>> >> [Thu Sep 29 19:12:55 2011] [info]: 323733 ((eval 1590):1)<BR>> >> Thank you.<BR>> >> Daniel Silveira<BR>> >><BR>> >> On Thu, Sep 29, 2011 at 11:10:20AM -0400, Xin, Qiao wrote:<BR>> >> > Hi,<BR>> >> ><BR>> >> > I have a scrip to to check when the ticket status changes. If I put it<BR>> >> as TransactionBatch mode,<BR>> >> > each time I change the ticket status, the scrip got fired twice and<BR>> >> there will be dupllicated emails<BR>> >> > sent out. I had to use TransactionBatch, since we want an email<BR>> >> notification to be sent out when<BR>> >> > either<BR>> >> > 1. the user use reply and modify the ticket status<BR>> >> > 2. modify the ticket status<BR>> >> ><BR>> >> > TransactionBatch works fine when user reply and modify ticket status<BR>> >> but got duplicated emails when<BR>> >> > just change ticket status.<BR>> >><BR>> >> Please show your scrip configuration<BR>> >><BR>> >> -kevin<BR>> ><BR>> >> --------<BR>> >> RT Training Sessions (http://bestpractical.com/services/training.html)<BR>> >> * San Francisco, CA, USA ? October 18 & 19, 2011<BR>> >> * Washington DC, USA ? October 31 & November 1, 2011<BR>> >> * Melbourne VIC, Australia ? November 28 & 29, 2011<BR>> >> * Barcelona, Spain ? November 28 & 29, 2011<BR>> ><BR>> ><BR>> > --------<BR>> > RT Training Sessions (http://bestpractical.com/services/training.html)<BR>> > * San Francisco, CA, USA -- October 18 & 19, 2011<BR>> > * Washington DC, USA -- October 31 & November 1, 2011<BR>> > * Melbourne VIC, Australia -- November 28 & 29, 2011<BR>> > * Barcelona, Spain -- November 28 & 29, 2011<BR>> ><BR>> <BR>> --<BR>> Best regards, Ruslan.<BR><BR>> --------<BR>> RT Training Sessions (http://bestpractical.com/services/training.html)<BR>> * San Francisco, CA, USA ? October 18 & 19, 2011<BR>> * Washington DC, USA ? October 31 & November 1, 2011<BR>> * Melbourne VIC, Australia ? November 28 & 29, 2011<BR>> * Barcelona, Spain ? November 28 & 29, 2011<BR><BR></DIV></BODY></HTML>