Hi David,<br><br>you the type of entity for which the event is trigger and type of entity that is being created in the event handler then you can add a check for module name something like this should work,<br><br><blockquote>
<font face="tahoma,sans-serif">function handleEvent($eventName, $entityData) {</font><br><font face="tahoma,sans-serif"> global $log, $adb;</font><br><br><font face="tahoma,sans-serif"> if($eventName == 'vtiger.entity.beforesave') { </font><br>
<font face="tahoma,sans-serif"> $moduleName = $entityData->getModuleName();</font><br><font face="tahoma,sans-serif"> if ($moduleName == 'HelpDesk') {<br> //your code here<br>
}<br> }<br>}<br><br></font></blockquote><font face="tahoma,sans-serif">This should avoid the infinite recursion, but if the entity being created and the </font>entity for which the event is of same type then this will not work.<br>
<br>Thanks,<br>MAK<br><br><br><div class="gmail_quote">On Fri, Mar 26, 2010 at 5:18 PM, Joe Bordes <span dir="ltr"><<a href="mailto:joe@tsolucio.com">joe@tsolucio.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff">
FYI: We ended up not using it and doing events the "old" way (coding).
It's faster but creates dependencies.<br>
<br>
In any case I expect this (and workflows) to get a lot better in next
releases and start using it then.<br>
<br>
This my experience, I am VERY comfortable with the code, so I tend to
go there for solutions.<br>
<br>
Joe<br>
TSolucio<br>
<br>
El 26/03/10 12:41, David V. escribió:
<blockquote type="cite"><div><div></div><div class="h5">Hi Everybody !<br>
<br>
According to this ticket : <a href="http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/5468" target="_blank">http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/5468</a><br>
<br>
<p>"When you add an aftersave event to an entity and in the <a href="http://trac.vtiger.com/cgi-bin/trac.cgi/wiki/HandleEvent" rel="nofollow" target="_blank">HandleEvent?</a> you create (and save) another entity,
it raises an infinite loop.
</p>
<p>
This occurs because VTEvenTrigger::trigger
(include/events/VTEventTrigger.inc), execute all handlers registered
when saving an entity. It should execute ONLY handler for current
entity"
</p>
According to the same ticket the solution is :<br>
<br>
"This is something the developer will have to handle in their own code.
There are events that will have to run on every save."<br>
<br>
But how do we actually handle this in the code ?<br>
<br>
Does anyone have a working example of how to avoid infinite loop
without modifying Vtiger core ?<br>
<br>
Thank you very much.<br>
<br clear="all">
David V.<br>
</div></div><pre><fieldset></fieldset>
_______________________________________________
Reach hundreds of potential candidates - <a href="http://jobs.vtiger.com" target="_blank">http://jobs.vtiger.com</a> </pre>
</blockquote>
<br><font color="#888888">
<br>
<pre cols="72">--
Un saludo
Joe
TSolucio</pre>
</font></div>
<br>_______________________________________________<br>
Reach hundreds of potential candidates - <a href="http://jobs.vtiger.com" target="_blank">http://jobs.vtiger.com</a> <br></blockquote></div><br>