[Vtigercrm-developers] add/remove relatedlist entry trigger eventhandler
Alan Lord
alanslists at gmail.com
Thu May 21 16:17:43 GMT 2015
I need to have an EventHandler which fires when a module has a record
either added or removed from it's related list in vtiger_crmentityrel.
Mod Tracker seems to be able to detect these events because the changes
get written to the ModTracker tables and diplay in the Updates summary
widgets etc...
However, having looked at the ModTracker Event Handler code, and
registered a test handler I cannot get it to fire at all...
I've registered it with:
> $em->registerHandler('vtiger.entity.aftersave.final', 'modules/LSContracts/resources/LSContractsEventHandler.php', 'PeakDemandEventHandler');
And my test code is:
> class PeakDemandEventHandler extends VTEventHandler {
>
> function handleEvent($eventName, $data) {
> global $log, $current_module, $adb, $current_user;
> require_once 'data/VTEntityDelta.php';
>
> $moduleName = $data->getModuleName();
>
> $log->debug("In " . __CLASS__ . " " . __FUNCTION__);
>
> if($eventName == 'vtiger.entity.aftersave.final') {
> $recordId = $data->getId();
> $columnFields = $data->getData();
> $vtEntityDelta = new VTEntityDelta();
> $delta = $vtEntityDelta->getEntityDelta($moduleName, $recordId, true);
>
> $log->debug("EntityDelta: " . print_r($delta,true));
> }
> }
> }
this fires if I change a *field* in a module, but it doesn't trigger if
I change a relationship in the crmentityrel table by either selecting or
deleting a record from the Related List... How can I do this please?
Thanks
Al
More information about the vtigercrm-developers
mailing list