- 新建安装需要的配置文件和语言包
新建install_modules/Mymodule/languages/en_us/Mymodule.php
新建install_modules/Mymodule/languages/zh_cn/Mymodule.php
'xxxx',
//.....
);
$jsLanguageStrings = array(
);
新建install_modules/Mymodule/modules/Mymodule/Mymodule.php
'crmid',
'vtiger_mymodule => 'mymoduleid',
'vtiger_mymodulecf'=>'mymoduleid');
/**
* Mandatory for Listing (Related listview)
*/
var $list_fields = Array (
/* Format: Field Label => Array(tablename, columnname) */
// tablename should not have prefix 'vtiger_'
'Account Name' => Array('vtiger_mymodule', 'accountname'),
'Assigned To' => Array('crmentity','smownerid')
);
var $list_fields_name = Array (
/* Format: Field Label => fieldname */
'Account Name' => 'accountname',
'Assigned To' => 'assigned_user_id',
);
// Make the field link to detail view
var $list_link_field = 'accountname';
// For Popup listview and UI type support
var $search_fields = Array(
/* Format: Field Label => Array(tablename, columnname) */
// tablename should not have prefix 'vtiger_'
'Account Name' => Array('mymodule', 'accountname'),
'Assigned To' => Array('vtiger_crmentity','assigned_user_id'),
);
var $search_fields_name = Array (
/* Format: Field Label => fieldname */
'Account Name' => 'accountname',
'Assigned To' => 'assigned_user_id',
);
// For Popup window record selection
var $popup_fields = Array ('accountname');
// For Alphabetical search
var $def_basicsearch_col = 'accountname';
// Column value to use on detail view record text display
var $def_detailview_recname = 'accountname';
// Used when enabling/disabling the mandatory fields for the module.
// Refers to vtiger_field.fieldname values.
var $mandatory_fields = Array('accountname','assigned_user_id');
var $default_order_by = 'accountname';
var $default_sort_order='ASC';
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType) {
global $adb;
if($eventType == 'module.postinstall') {
// TODO Handle actions after this module is installed.
} else if($eventType == 'module.disabled') {
// TODO Handle actions before this module is being uninstalled.
} else if($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else if($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else if($eventType == 'module.postupdate') {
// TODO Handle actions after this module is updated.
}
}
}
新建install_modules/Mymodule/manifest.xml
2017-11-27 11:07:36
Mymodule
Support
2.0
6.0.0rc
6.*
vtiger_mymodule
vtiger_mymodulecf
mymodule_no
4
mymodule_no
vtiger_mymodule
1
Payments No
1
0
2
100
V~O
3
0
1
BAS
0
servicecontractsid
51
servicecontractsid
vtiger_mymodule
1
ServiceContract Name
1
2
9
100
V~O
1
1
BAS
1
assigned_user_id
53
smownerid
vtiger_crmentity
1
Assigned To
1
2
4
100
V~M
0
2
1
BAS
1
createdtime
70
createdtime
vtiger_crmentity
1
Created Time
1
0
14
100
DT~O
3
2
BAS
0
modifiedtime
70
modifiedtime
vtiger_crmentity
1
Modified Time
1
0
15
100
DT~O
3
2
BAS
0
modifiedby
52
modifiedby
vtiger_crmentity
1
Last Modified By
1
0
16
100
V~O
3
3
BAS
0
description
19
description
vtiger_crmentity
1
Notes
1
2
1
100
V~O
1
1
BAS
1
All
true
false
mymoduleid
1
mymodule_no
0
public_readwritedelete
enabled
get_related_list
1
0
ADD
SELECT
Account
将install_modules/Mymodule/打包为zip文件。
cd install_modules/Mymodule
zip -q -r mymodule.zip ./
2、安装
访问
http://你的项目域名/index.php?module=ModuleManager&parent=Settings&view=List&block=2&fieldid=8
按步骤进行安装
3、如有报错,则追踪代码。
比如常见的vtiger_ws_entity表中没有插入刚才安装的模块的数据。
vtiger_entityname表中也需要新增一条刚才新加模块的记录
具体的报错要跟踪代码打断点。
vitger个大坑货。文档不全,代码冗杂,无力吐槽