This post will explain how to make your
custom person module work with SugarCRM campaigns in the same way the default
modules work (Leads,Contacts,Prospects,Users,Accounts.)
In the examples below you must
replace {MODULE} with the name of your custom module.
1. Add a custom list view for your custom
module (custom/modules/{MODULE}/views/view.list.php)
require_once('include/MVC/View/views/view.list.php');
class {MODULE}ViewList extends ViewList
{
public function preDisplay()
{
parent::preDisplay();
$this->lv->targetList = true;
}
}
2. Create extended vardef for prospect list
-> custom module relationship
(custom/extension/modules/{MODULE}Ext/Vardefs/prospect_list_{MODULE}.php
$dictionary["{MODULE}"]["relationships"]['prospect_list_{MODULE}] = array (
'lhs_module' => 'ProspectLists',
'lhs_table' => 'prospect_lists',
'lhs_key' => 'id',
'rhs_module' => ‘{MODULE}’,
'rhs_table' => '{MODULE_TABLE}’,
'rhs_key' => 'id',
'relationship_type' => 'many-to-many',
'join_table' => 'prospect_lists_prospects',
'join_key_lhs' => 'prospect_list_id',
'join_key_rhs' => 'related_id',
'relationship_role_column' => 'related_type',
'relationship_role_column_value' => ‘{MODULE}’
);
$dictionary["{MODULE}"]["fields"]["prospect_lists"] = array (
'name' => 'prospect_lists',
'type' => 'link',
'relationship' => 'prospect_list_{MODULE}’,
'source' => 'non-db'
);
3. Create a subpanel definition to show the
prospect list subpanel on your custom module
(custom/extension/modules/{MODULE}/Ext/Layoutdefs/ProspectListSubpanel.php)
$layout_defs["{MODULE}"]["subpanel_setup"]["prospect_lists"] = array (
'order' => 10,
'sort_by' => 'name',
'sort_order' => 'asc',
'module' => 'ProspectLists',
'subpanel_name' => 'default',
'get_subpanel_data' => 'prospect_lists',
'title_key' => 'LBL_PROSPECT_LISTS_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopButtonQuickCreate'),
array('widget_class'=>'SubPanelTopSelectButton','mode'=>'MultiSelect'),
),
);
4. Create a subpanel def for your custom
module on the prospect list detailview(custom/extension/modules/ProspectLists/Ext/Layoutdefs/prospect_lists_{MODULE}.php
$layout_defs["ProspectLists"]["subpanel_setup"]["{MODULE}"] = array (
'order' => 10,
'sort_by' => 'name',
'sort_order' => 'asc',
'module' => ‘{MODULE}’,
'subpanel_name' => 'ForProspectLists',
'get_subpanel_data' => ‘{MODULE}’,//lowercase!!
'title_key' => 'LBL_{MODULE}_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopButtonQuickCreate'),
array('widget_class'=>'SubPanelTopSelectButton','mode'=>'MultiSelect'),
),
);
5. Create a vardef relationship field
extension in custom/extensions/modules/ProspectLists/Exy/Vardefs/custom.php
$dictionary['ProspectList']['fields'][‘{MODULE}’] =array (
'name' => '{MODULE}',//lowercase!!
'type' => 'link',
'relationship' => 'prospect_list_{MODULE},
'source'=>'non-db',
);
6. Create subpanel metadata – Copy
modules/{MODULE}/metadata/subpanels/default.php to
custom/modules/{MODULE}/metadata/subpanels/ForProspectLists.php
7. Edit modules/EmailMan/EmailMan.php
around line 453 add
$this->ref_email->load_relationship(‘{MODULE_EMAILS_REL_NAME’);
You must have a relationship between your
custom module and the emails module. You can find the name of the of
relationship by looking in
custom/Extension/modules/Emails/Ext/Vardefs/custom{MODULE}_activities_emails.php
at the “name” property.
Arround line 482 add a new case to the
switch statement for your custom module
case ‘{MODULE}’:
$rel_name="{MODULE_EMAILS_REL_NAME}";
break;
No comments:
Post a Comment