http://community.vtiger.com/help/vtigercrm/developers/extensions/examples/entity-module.html
using documentation given on the above link, I created a custom module named as Leaves. Now, next task was to add activity module to the Leaves module. I used following code do accomplish the same.
include_once('vtlib/Vtiger/Module.php');
$moduleInstance = Vtiger_Module::getInstance('Leaves');
$accountsModule = Vtiger_Module::getInstance('Calendar');
$relationLabel = 'Activities';
$moduleInstance->setRelatedList(
$accountsModule, $relationLabel, Array('ADD','SELECT'), 'get_activities'
);
Now, in module/Leaves/Leaves.php i copied get_activities function from Accounts.php module of Accounts module. it should have worked now but it did not.
I added a single leave and opened it's detail view. I became happy by seeing Activities Label there. I clicked on it and added 2 events for particular single leave. Ideally, All events i.e 2 events that i recently added must be listed there but there was no event.
I checked codes and found out that a relation is being stored in 'vtiger_seactivityrel' table with activityid and single leave id(crmid). But when i add event from Leaves module. Activity is created but relation is not stored in 'vtiger_seactivityrel'. I made relation manually by adding activityid and crmid then it started showing events.
Hence, the question that is being raised here why 'vtiger_seactivityrel' table is not populated.
Please somebody help me if you have solution.I have attached Image of one such leave which is showing blank even after adding event.
After lot of research i found out that i needed to update vtiger_ws_referencetype table for making the relation. Here is the query for the same. In my case custommodulename will be replaced by Leaves.
insert into vtiger_ws_referencetype(fieldtypeid,type) values (34,'custommodulename');