<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true" text="#000000" bgcolor="#FFFFFF">
Dear Vtiger Team,<br>
<br>
<b>Tested. It works:</b><br>
<br>
To avoid modifying core files, we can take place the custom Contacts
handler into the Custom module director.<br>
<br>
<b>The step 1, registering the eventhandler file in an other place:
</b><br>
$moduleInstance = Vtiger_Module::getInstance('Contacts');<br>
Vtiger_Event::register(<br>
$moduleInstance, 'vtiger.entity.aftersave',<br>
'Contacts<b><font color="#cc0000">Custommodule</font></b>Handler','modules/<b><font
color="#cc0000">Custommodule</font></b>/Contacts<font
color="#cc0000"><b>Custommodule</b></font>Handler.php'<br>
);<br>
Vtiger_Event::register(<br>
$moduleInstance, 'vtiger.entity.beforesave',<br>
'Contacts<b><font color="#cc0000">Custommodule</font></b>Handler','modules/<font
color="#cc0000"><b>Custommodule</b></font>/Contacts<font
color="#cc0000"><b>Custommodule</b></font>Handler.php'<br>
);<br>
<br>
<b><font color="#3333ff">(Here is the small change in th Step 1: You
should use the Contacts module instance instead of the plain
module name.)<br>
</font></b><br>
<b>The step 2, create a handler file in the Custommodule directory:</b><br>
<br>
modules/<font color="#cc0000"><b>Custommodule</b></font>/Contacts<font
color="#cc0000"><b>Custommodule</b></font>Handler.php<br>
<?php class Contacts<b><font color="#cc0000">Custommodule</font></b>Handler
extends VTEventHandler {<br>
function handleEvent($eventName, $data) {<br>
if($eventName == 'vtiger.entity.beforesave') {<br>
// Entity is about to be saved, take required
action<br>
<font color="#cc0000"> // Some code to handle
Contacts related actions in the related module.</font><br>
}<br>
if($eventName == 'vtiger.entity.aftersave') {<br>
// Entity has been saved, take next action<br>
<font color="#cc0000"> // Some code to handle
Contacts related actions in the related module.</font><br>
}<br>
}<br>
} <br>
?><br>
<br>
Summary: We can register an event handler with any name in any
place. And it will trigger the "vtiger.entity.beforesave" and the
"vtiger.entity.aftersave" events also.<br>
You do not need to change core files to catch an event e.g. from
Contacts, Leads or other modules.<br>
<br>
<br>
Kindest regards:<br>
István<br>
<br>
<div class="moz-signature">-- <br>
üdvözlettel:<br>
<br>
<b>Holbok István</b><br>
<br>
+3670-342-0900<br>
<b>e-mail:</b> <a class="moz-txt-link-abbreviated"
href="mailto:holbok@gmail.com">holbok@gmail.com</a><br>
<b>SkyPe:</b> holboki<br>
<br>
</div>
</body>
</html>