Hi Andreas,<br><br>What you noticed is partially correct. All the events from vtiger_eventhandlers are picked up one by one and executed irrespective of the module for which it is created. <br><br>For which modules should each of the event handler be triggered, is controlled by the condition part of the event handler.<br>
<br>It is also possible for you to specify conditions that restrict when the handler will be executed. You might want an event to be fired only for changes in a particular module. Currently the conditions are restricted to selecting module names<br>
<br>Example:<br>require 'include/events/include.inc';<br>$em = new VTEventsManager($adb);<br>$em->registerHandler($eventName, $filePath, $className, 'moduleName in ['Contacts', 'Accounts']);<br>
<br>In the above example the event will only be triggered if the triggering entity is of the module Contacts or Accounts.<br>
<br><div><span class="gmail_quote">On 9/16/09, <b class="gmail_sendername"><a href="mailto:admin@a-g-c.de" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">admin@a-g-c.de</a></b> <<a href="mailto:admin@a-g-c.de" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">admin@a-g-c.de</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br> I guess I found a bug in the eventing logic, or I just do not know how<br> to use it properly. In the latter case we might have a bug in the<br> documentation ;-)<br> <br> Assuming:<br> I have two custom modules (A and B).<br>
Both custom modules implement own event handlers (AHandler, BHandler)<br> for the events vtiger.entity.aftersave and vtiger.entity.beforesave.<br> I do have the according entries in the tables vtiger_eventhandlers and<br>
vtiger_eventhandler_module as well.<br> <br> After implementing the eventhandler of module B for event<br> vtiger.entity.beforesave I realized that this event handler is executed<br> when module A is saved (and also when module B is saved).<br>
<br> I had a look at the according event sources and it seems to me that<br> there is no logic implemented that checks which event handler to use for<br> which module. It just catches the next event handler class from the<br>
table vtiger_eventhandlers, without considering the data stored in table<br> vtiger_eventhandlers_module (which handler to use for which module).<br> <br> There is a method implemented to read vtiger_eventhandlers_module, but<br>
it is not used at all in vtiger 5.1.0!<br> <br> Any clues?<br> Is this an open development topic?<br> <br> Kind Regards<br> Andreas<br> <br> _______________________________________________<br> Reach hundreds of potential candidates - <a href="http://jobs.vtiger.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://jobs.vtiger.com</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Asha<br>vtiger Team