[Vtigercrm-developers] Event Handler broken [Solved]

Alan Lord alanslists at gmail.com
Thu Nov 29 07:17:39 PST 2012


Well,

I have no idea why this broke at all.

But after a great deal of digging, I discovered that if I remove all 
data from the "cond" field of the vtiger_entityhandlers table, then it 
all seems to work. It means I must do the testing in my handler to check 
I am being triggered by the right module(s) but at least it seems to work.

Has something changed in PHP recently to break this?

There are two other reports of this error:

https://forums.vtiger.com/viewtopic.php?f=139&t=54986

http://permalink.gmane.org/gmane.comp.web.vtigercrm.devel/5668

But no solutions - other than *don't* specify a condition value in your 
Entity Registration as is decribed here: 
https://wiki.vtiger.com/index.php/510:Eventing

Can one of the vtiger devs confirm this or not?

I'm sure this was working for me up until very recently, but I could 
have missed it, or it was due to a recent upgrade of the system (perhaps 
a PHP minor version hike? Currently on 5.3.10-1ubuntu3.4 with 
Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) )

Cheers

Al


On 29/11/12 12:30, Alan Lord wrote:
> Anyone seen this before?
>
> Fatal error: Uncaught exception 'Exception' with message 'Deadlock
> occured for events: CompaniesHandler' in
> /var/www/vtiger/include/events/VTEventTrigger.inc:155 Stack trace: #0
> /var/www/vtiger/include/events/VTEventsManager.inc(118):
> VTEventTrigger->trigger(Object(VTEntityData)) #1
> /var/www/vtiger/data/CRMEntity.php(812):
> VTEventsManager->triggerEvent('vtiger.entity.a...',
> Object(VTEntityData)) #2 /var/www/vtiger/modules/Accounts/Save.php(103):
> CRMEntity->save('Accounts') #3 /var/www/vtiger/index.php(749):
> include('/var/www/vtiger/mo...') #4 {main} thrown in
> /var/www/vtiger/include/events/VTEventTrigger.inc on line 155
>
> I can't work out what has caused it to stop working :-(
>
> Now I can't save any entity, even though the Event Handler registration
> record has
>
> event_name:    vtiger.entity.aftersave
> handler_path:  modules/Companies/CompaniesHandler.php
> handler_class: CompaniesHandler
> cond:          moduleName in ['Companies', 'Quotes', 'SalesOrder',
> 'Invoice']
> is_active:     1
> dependent_on:  []
>
> so it shouldn't be triggered at all when I am trying simply to save a
> Lead or an Account for example.
>
> In the CompaniesHandler class I also have a check:
>
> class CompaniesHandler extends VTEventHandler {
> 	
> 	function handleEvent($eventName, $data) {
> 		if($eventName == 'vtiger.entity.aftersave') {
> 			$module = $data->getModuleName();
> 			if ($module == "Companies") {
> 				self::coPreProccessor($data);
> 			} else if ($module == "Invoice" || $module == "Quotes" || $module ==
> "SalesOrder") {
> 				self::updateCoSeqData($data);
> 			}
> 		}
> 	}
>
> This was all working until recently (I think) but something seems to
> have caused it to break and I can't work out what...
>
> But firstly, why on earth is my event handler even being called when I
> am saving an entity which is not in the event registration condition field?
>
> The entity does actually get saved by the way. So this error is
> definitely happening on the "aftersave" event trigger...
>
> Cheers
>
> Al
>
>
> _______________________________________________
> http://www.vtiger.com/
>




More information about the vtigercrm-developers mailing list