[Vtigercrm-developers] Registered Event for Invoice module also being used by other modules
Lennart van Ballegoij
lennart at egmmedia.nl
Fri Dec 25 01:40:47 GMT 2015
Hi,
I've been working on a Vtiger module that sends the data of a saved Invoice
to a third party API.
I'm using a Event Handler to retrieve the data from the Invoice module
and process it to send it to the third party API.
After finishing the module i started testing it and it worked great except
for returning empty entry's to the database from time to time.
When i looked into what caused the empty entry's i found out that it was
caused by the save of other modules.
But i thought the Event Handler will only run for the Module that was
registered in the Vtiger_Event::register ?
Is this not the case or am i just doing something wrong ?
My Vtiger event register code:
public function registerInvoiceEvent(){
if(Vtiger_Event::hasSupport()) {
Vtiger_Event::register(
'Invoice', 'vtiger.entity.aftersave',
'ReeleezeeHandler',
'modules/Reeleezee/ReeleezeeHandler.php'
);
}
}
My Event handler code:
class ReeleezeeHandler extends VTEventHandler {
public $helper = null;
public function __construct(){
require 'modules/Reeleezee/Helper.php';
$this->helper = new Reeleezee_Helper();
}
function handleEvent($eventName, $data) {
if($eventName == 'vtiger.entity.aftersave') {
if ($data) {
$moduledata = $data->getData();
//More code here but don't think it's relevant
}
}
}
Can anybody give me a push in the right direction for why this is happening
?
Thanks in advance!
Kind regards,
Lennart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20151225/67c74b57/attachment.html>
More information about the vtigercrm-developers
mailing list