MAK,<br><br>It works perfectly !!!<br><br>For future reference I wanted to make clear that in the example provided by MAK, <font face="tahoma,sans-serif">HelpDesk is the module from wich you are</font> saving and NOT the target module in wich you want the new entity to be created.<br clear="all">
David V.<br>
<br><br><div class="gmail_quote">2010/3/26 David V. <span dir="ltr"><<a href="http://davidv.net">davidv.net</a>@<a href="http://gmail.com">gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thank you MAK,<br><br>I'll try that.<br><br clear="all">David V.<br>
<br><br><div class="gmail_quote">2010/3/26 Musavir Khan <span dir="ltr"><<a href="mailto:musavir@vtiger.com" target="_blank">musavir@vtiger.com</a>></span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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<div><div></div><div><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" target="_blank">joe@tsolucio.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; 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>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>
</div></div><br>_______________________________________________<br>
Reach hundreds of potential candidates - <a href="http://jobs.vtiger.com" target="_blank">http://jobs.vtiger.com</a> <br></blockquote></div></div></div><br>
</blockquote></div><br>