1 運行環境搭建
1.1 環境搭建
軟件vTigerCRM是以Apache為Web服務器,MySQL為數據庫,因此選擇XAMPP作為其運行環境,在Linux上采用LAMPP,在Windows系統上采用WAMPP。本次研究環境選擇WAMPP。
操作系統:Windows 7
Web環境:WAMPP 1.7.7
1)MySQL版本:5.5.16
2)PHP版本:5.3.8
3)Apache版本:2.2.21
4)phpMyAdmin: 3.4.5
5)FileZilla FTP Server: 0.9.39
6)Tomcat: 7.0.21 (with mod_proxy_ajp as connector)
研究對象:vTigerCRM 5.3.0
開發工具:NetBeans 7.0.1
本研究報告的運行環境包括WAMPP 1.7.7和vTigerCRM 5.3.0,下載地址如下:
WAMPP:http://www.apachefriends.org/en/xampp.html(下載WAMPP)
vTigerCRM:http://wiki.vtiger.com/index.php/Vtiger530:Downloads
NetBeans:http://netbeans.org/
在本次研究中,XAMPP的安裝路徑為F:\XAMPP1.7.7
說明:本次研究側重軟件本身,操作系統和軟件自身可能存在的安全性不在研究范圍內,考慮到研究的方便性,采用Windows 7操作系統。
1.2 WAMPP安裝
WAMPP安裝步驟如下:
1) 下載WAMPP 1.7.7,地址:http://www.apachefriends.org/download.php?xampp-win32-1.7.7-VC9-installer.exe
2) 下載完成后,執行該程序;
3) 設置安裝路徑,例如“F:\XAMPP1.7.7”。安裝最后,提示選擇“Put XAMPP to desktop”,即把XAMPP控制台放到桌面。
4) 運行XAMPP控制台,啟動Apache和MySQL,可注冊為系統服務自動啟動。
5) 在瀏覽器訪問:http://localhost/xampp,如果正常,則安裝成功。
6) 使用root登錄進入phpmyadmi,設置root密碼;
7) 編輯安裝路徑F:\xampp1.7.7\phpMyAdmin\config.inc.php,將$cfg['Servers'][$i]['auth_type'] = 'config';修改為$cfg['Servers'][$i]['auth_type'] = 'cookie';
8) 編輯F:\xampp1.7.7\mysql\bin\my.ini,在[client]下添加“default_character_set = utf8”,在[mysqld]下添加“character_set_server=utf8”和“collation_server=utf8_unicode_ci”,重新啟動mysql;
1.3 vTigerCRM安裝
vTigerCRM5.3.0安裝步驟如下:
下載vTigerCRM 5.3.0,地址:http://www.vtiger.com/vtiger-crm/downloads/,選擇“SOURCE”下載項。
將下載包解壓縮到F:\xampp1.7.7\htdocs\vtigercrm530,參考如下鏈接進行安裝:http://service.syncomni.com:10080/twiki/bin/view/Syncomni/VTigerCRMSetup
安裝需要5-10分鍾。
安裝完成后,下載中文語言包,下載地址為:http://service.syncomni.com:10080/twiki/pub/Syncomni/VTigerCRMSetup/vTiger_CRM_zh_cn_5.2_Release_20101001.zip,然后解壓縮到f:\xampp1.7.7\htdocs\vtigercrm530目錄下。
打開mysql命令行,執行:
INSERT INTO `vtiger_language` VALUES ('9', '簡體中文', 'zh_cn', '簡體中文', '2012-01-12', NULL , '1', '1');
並將第1條記錄的is_default設置為0。
使用admin登錄到http://localhost/vtigercrm530/index.php
在My Preferences(右上角)中設置Language為“簡體中文”,刷新頁面即可顯示中文。
打開F:\XAMPP1.7.7\htdocs\vtigercrm530\config.inc.php,將$default_language = 'en_us'修改為$default_language = 'zh_cn',即把中文設置為默認語言。
安裝到此完成。
2 研究報告
2.1 登錄界面
從5.3.0版本之前,登錄界面提供語言選擇,在5.3.0版本中,默認語言的設置轉到了config.inc.php中,用戶登錄后可以在“我的信息”->“更多信息”->“語言”中修改喜歡的語言。
登錄界面定義文件:Login.tpl
2.2 菜單
2.2.1 參考
http://wiki.vtiger.com/index.php/Creating_New_Module
http://forums.vtiger.com/viewtopic.php?t=26465
2.2.2 菜單相關的數據
菜單分為主菜單和子菜單,在vTiger中主菜單稱為parent tab,子菜單稱為child tab。
與主菜單相關的文件有parent_tabdata.php,該文件定義了主菜單全局變量$parent_tab_info_array,以及和其相關的子菜單(模塊)編碼數組$parent_child_tab_rel_array。
相關的數據庫表有vtiger_parenttab和vtiger_parenttabrel。
和菜單相關的源代碼文件:include/utils/CommonUtils.php
如果一個主菜單下的任何模塊,不允許當前用戶訪問,則登錄后該主菜單不會顯示。
建議增加一個獨立菜單編輯器工具,用於管理主菜單和子菜單。該工具只給特定的軟件開發人員使用。
2.2.3 全局變量
文件名 |
變量 |
用途 |
tabdata.php |
$tab_info_array |
定義模塊編碼 |
$tab_seq_array |
|
|
$tab_ownedby_array |
|
|
$action_id_array |
|
|
$action_name_array |
|
|
parent_tabdata.php |
$parent_tab_info_array |
定義主菜單 |
$parent_child_tab_rel_array |
定義主菜單中包含的子菜單(模塊)編碼,參見$tab_info_array |
|
|
|
|
2.2.4 菜單相關代碼的研究
文件:CommonUtils.php
函數:checkParentTabExists($parenttab)
要點:如果文件parent_tabdata.php存在,則使用全局變量$parent_tab_info_array,否則,使用數據庫表vtiger_parenttab。
函數:getParentTabFromModule($module)
要點:如果文件tabdata.php和parent_tabdata.php存在,則根據文件中定義的全局變量計算;否則根據數據庫表vtiger_parenttab、vtiger_tab和vtiger_parenttabrel計算。
函數:getHeaderArray()
要點:需要包含parent_tabdata.php,否則訪問頁面時會有warning,提示沒有該文件,主菜單也無法顯示。
總結:
通過對vTigerCRM 5.3.0的研究,菜單相關的數據既保存到文件,也保存到數據庫,目前尚不清楚為什么分兩處存放。在已有的函數或方法中,既有同時支持文件和數據庫存儲的方式,也有只支持文件,或者只支持數據庫的方式。因此,如果對主菜單進行操作,既要修改文件,也要修改相關數據庫。詳細的研究過程參加章節“附錄1:實驗->2. 增加新主菜單”。
建議:
將主菜單數據統一存儲到數據庫。
2.2.5 支持中文
添加語言配置:簡體中文
執行如下SQL添加中文幣種,並在“設置>貨幣”中添加RMB。
INSERT INTO vtiger_currencies( `currency_name`, `currency_code`,`currency_symbol` ) VALUES ( '人民幣元', 'RMB', '¥' ); |
另外,編輯表vtiger_currency_info,將人民幣的defaultid設置為-11,作為基礎幣種,美元的defaultid設置為0,同時設置好匯率。在“我的設定>貨幣”中設置好當前用的幣種即可。
2.3 字段Fields
參考:
http://wiki.vtiger.com/index.php/Creating_New_Fields_in_Existing_Modules
http://wiki.vtiger.com/index.php/Ui_types
http://forums.vtiger.com/viewtopic.php?t=25886
2.3.1 常用相關字段的匹配表
類型解釋
1) Generated Type
2) Display Type
a) 值為1:在所有視圖中顯示
b) 值為2:在DetailView中顯示(只讀,不包括編輯視圖EditView)
c) 值為3:不單獨顯示,與其他字段相關
d) 值為4:只在CreateView視圖中顯示
UI Type (默認值1) |
說明 |
Column Type (默認值:VARCHAR(100)) |
GeneratedType (默認值1) |
Type Of Data (默認值V~O) |
Display Type (默認值1) |
Quick Create (默認值1) |
6 |
日期時間datetime |
DATETIME |
|
DT~M |
|
|
2 |
文本框textbox |
VARCHAR(255) |
|
V~M |
|
|
4 |
Text box with Inheritance, mandatory entry |
VARCHAR(100) |
2 |
|
|
3 |
15 |
下拉框droplist |
VARCHAR(255) |
|
V~M |
|
|
53 |
用戶名下拉框 |
VARCHAR(100) |
|
|
|
|
70 |
日期date |
VARCHAR(100) |
|
T~O |
2 |
|
101 |
用戶名彈出窗口 |
VARCHAR(36) |
1 |
V~O |
1 |
1 |
56 |
檢查框checkbox |
|
1 |
V~/C~ |
1,3 |
1,2,3 |
28 |
文件上傳 |
|
|
|
|
|
19 |
占2個顯示單元的描述 |
Varchar(255) |
1 |
|
|
|
21 |
占1個顯示單元的描述 |
Varchar(255) |
1 |
|
|
|
10 |
通用彈出窗口 |
Varchar(255) |
|
|
|
|
2.3.2 自定義編碼
模塊中如果定義了自定義編碼字段(uitype=4,generatedtype=2,quickcreate=3),其編碼值可以通過“設置 > Customize Record Numbering”進行設置,相關表是vtiger_modentity_num。
2.3.3 下拉框
用途:用在兩個或者兩個以上可選擇數據的情況。在一個下拉框中可以根據不同的角色分配不同的值。當一個模塊中,有2個或者更多的下拉框,且下拉框之間的數據有關聯關系的時候,可以通過設置定義依賴關系。
下拉框相關的數據庫表包括:
表名 |
說明 |
vtiger_picklist |
定義下拉框的編碼和名稱 |
vtiger_picklist_seq |
保存vtiger_picklist中最大的picklistid |
vtiger_picklistvalues_seq |
保存最新的下拉框的值,以后依次加1 |
vtiger_picklist_dependency |
定義兩個下拉框之間的數據邏輯關系,在“設置->編輯下拉框之間依賴關系”中設置 |
vtiger_picklist_dependency_seq |
保存vtiger_picklist_dependency中最大id |
vtiger_role2picklist |
定義角色與下拉框的對應關系,在“設置->下拉框編輯”中設置 |
vtiger_<picklist_name> |
下拉框名為“picklist_name”的值 |
vtiger_<picklist_name>_seq |
保存vtiger_<picklist_name>中最大id |
2.4 Uitype的研究
2.4.1 相關文件
視圖模板:EditViewUI.tpl(查詢uitype eq)
后台代碼:CRMEntity.php,DetailView.php,EditView. php(可搜索包含文字“uitype == ”)
2.4.2 自定義UITYPE
新增uitype從1000開始編碼,如果是對已有uitype的擴充,則新的uitype編碼=1000+原uitype。例如,基於uitype 28新增一個uitype,則新的uitype值為1028.
新增uitype需要兩方面工作:
1) 界面顯示:編輯smarty/templates/EditViewUI.tpl,找到參考的uitype,復制並進行相應修改;
2) 后台邏輯:選擇編輯如下文件:
a) data/CRMEntity.php
b) include/utils/DetailViewUtils.php
c) include/utils/DetailViewUtils.php/EditViewUtils.php
2.5 調試
2.5.1 日志設置
參考:
http://wiki.vtiger.com/archives/index.php?title=Developer:Debug_techniques
http://wiki.vtiger.com/archives/index.php/Log4php
修改config.performance.php中的參數:
'LOG4PHP_DEBUG' => true, |
編輯log4php.properties,打開LOG4PHP的日志標志:
log4php.rootLogger=DEBUG,A1 |
2.6 Smarty模板
2.6.1 模板調用
當需要定制List View或者模塊的配置頁面時,需要創建一個Smart Template的模板文件。模板文件應該創建在Smarty/templates/modules/<NewModuleName>目錄下。
調用模板的代碼如下:
$smarty->display(vtlib_getModuleTemplate($currentModule, 'MyListview.tpl')); |
2.6.2 Field的顯示模板
文件:Smarty/templates/EditViewUI.tpl
功能:根據uitype進行顯示
說明:當需要修改某種uitype的顯示時,可在此文件中修改。
2.6.2.1 在模板中顯示當前用戶名
在“模塊/EditView.php”中給模板$CURRENT_USERNAME賦值;
global $current_user; |
然后,可以在模板中使用,例如在EditFieldUI.tpl中,將uitype101的默認值設置為當前用戶名。
{elseif $uitype eq 101}<!-- for reportsto field USERS POPUP --> <td width="20%" class="dvtCellLabel" align=right> <font color="red">{$mandatory_field}</font>{$usefldlabel} {if $MASS_EDIT eq '1'}<input type="checkbox" name="{$fldname}_mass_edit_check" id="{$fldname}_mass_edit_check" class="small" >{/if} </td> <td width="30%" align=left class="dvtCellInfo"> <input id="{$fldname}_display" name="{$fldname}_display" readonly type="text" style="border:1px solid #bababa;" {if isset($fldname)} value="{$fldvalue}" {else} value="{$CURRENT_USER}" value="{$fldvalue}" class="small" /> <input id="{$fldname}" name="{$fldname}" type="hidden" value="{$secondvalue}" id="{$fldname}" /> <input title="{$APP.LBL_CHANGE_TITLE}" accessKey="C" type="button" class="small" value='{$APP.LBL_CHANGE}' name="btn1" onclick='return window.open("index.php?module=Users&action=Popup&html=Popup_picker&form=vtlibPopupView&form_submit=false&fromlink={$fromlink}&recordid={$ID}&forfield={$fldname}","test","width=640,height=603,resizable=0,scrollbars=0");'> <input type="image" src="{'clear_field.gif'|@vtiger_imageurl:$THEME}" alt="{$APP.LBL_CLEAR}" title="{$APP.LBL_CLEAR}" onClick="this.form.{$fldname}.value=''; this.form.{$fldname}_display.value=''; return false;" align="absmiddle" style='cursor:hand;cursor:pointer'> </td> |
2.7 文件上傳
2.7.1 附件相關表
表名 |
說明 |
vtiger_seattachmentsrel |
定義crmid(表vtiger_crmentity)與附件的關系。 |
Vtiger_attachments |
附件信息 |
vtiger_attachmentsfolder |
|
vtiger_attachmentsfolder_seq |
|
2.7.2 界面
上傳文件UI設置如下:
|
2.8 vtlib
參見:http://service.syncomni.com:10080/twiki/bin/view/Syncomni/VTigerCRMVtlibManual
2.9 全局數據
數據 |
變量 |
當前用戶 |
$current_user |
2.10 數據庫表研究
2.10.1 Vtiger_entityname
功能:記錄模塊實體的名字信息
字段 |
描述 |
|
|
2.10.2 Vtiger_field
字段含義及其賦值:http://service.syncomni.com:10080/twiki/bin/view/Syncomni/VTigerCRMFieldSetting
2.10.3 Vtiger_time_zone
將Asia/Taipei改為Asia/Beijing
2.10.4 vtiger_fieldmodulerel
記錄與某一個field相關的模塊。
2.11 權限控制
2.11.1 總述
2.11.2 字段數據的權限控制
不同的角色可以看到不同的picklist類型的數據,這些數據在Settings>Picklist Editor中配置。
2.12 工作流
參考:http://wiki.vtiger.com/index.php/vtiger510:Module_Workflow
2.13 報表
2.14 文件上傳
部分配置在config.inc.php中的配置可以通過“設置>Configuration Editor”編輯。
2.15 模塊Documents
這個模塊比較特殊,與其對應的表是vtiger_notes。
2.16 關於刪除
2.16.1 批量刪除
如果一個模塊不允許批量刪除,編輯模塊下的ListView.php,注釋掉如下內容,將不會在界面上顯示批量刪除的按鈕:
if(isPermitted($currentModule,'Delete','') == 'yes') $list_buttons['del'] = $app_strings[LBL_MASS_DELETE]; |
2.16.2 單條刪除
如果一個模塊不允許批量刪除,編輯模塊下的Delete.php,注釋掉如下內容,將不會執行刪除操作:
DeleteEntity($currentModule, $return_module, $focus, $record, $return_id); |
2.17 一條記錄包含多條明細
實例:例如銷售訂單(SalesOrder)模塊中,當添加一個銷售訂單時,可以添加多個產品。
本章節重點研究如何實現上述功能。
第一步,將產品信息移植到模塊實例Systeo中。
在Smarty/templates下建立目錄TrainingPlan,將Smarty/templates/ProductDetails.tpl復制到該目錄中。
2.18 Theme開發
2.19 系統配置
2.19.1 時區
文件:config.inc.php
修改:$default_timezone = 'Asia/Shanghai';
2.20 軟件體系結構
3 vTiger開發工具
3.1 總述
使用jquery作為javascript開發包,所有javascript的調用都寫在新增的文件jquery_vtiger_tools.js中。
版本:jquery1.7.1
3.2 增加主菜單
功能:增加一個主菜單
算法:在vtiger_parenttab表中增加主菜單,並同步到文件parent_tabdata.php
vTiger代碼修改:在vtlib/Vtiger/Menu.php中增加靜態方法:
/** * Add one main tab, if the tab name exists, then do nothing. * @param main tab name * By Kevin Wang, 2012/2/1 */ static function addMainMenu($tab_id, $tab_label, $seq) {
self::log("Enter addMainMenu ..."); global $adb; $query = false; $instance = false;
$query = "SELECT * FROM vtiger_parenttab WHERE parenttabid=?"; $result = $adb->pquery($query, Array($tab_id)); if($adb->num_rows($result)) { self::log("Main tab [label=$tab_id] exists! Cannot add again!"); return 1; }
$query = "SELECT * FROM vtiger_parenttab WHERE parenttab_label=?"; $result = $adb->pquery($query, Array($tab_label)); if($adb->num_rows($result)) { self::log("Main tab [label=$tab_label] exists! Cannot add again!"); return 1; }
$adb->pquery("INSERT INTO vtiger_parenttab (parenttabid,parenttab_label,sequence,visible) VALUES(?,?,?)", Array($tab_id, $tab_label, $seq, 0));
self::log("Main tab [id=$tab_id, label=$tab_label,seq=$seq] is added to menu ... DONE"); self::syncfile();
return 0; } |
工具實現:增加文件add_main_menu.html和add_main_menu.php,在jquery_vtiger_tools添加AJAX調用實現。
依賴:jquery/jquery1.7.1.js
4 vTiger開發流程
4.1 理解需求
充分理解客戶需求,明確:
1) 每個功能需求涉及到的業務數據及其格式
2) 和功能相關的配置數據以及修改頻率的高低
3) 需求對功能和數據的權限要求
4) 業務流程
在理解需求的基礎上,由測試人員負責編寫測試計划。
4.2 設計
在充分理解需求的前提下,划分功能模塊,主要工作如下:
1) 定義出模塊數目及其功能
2) 對每個模塊設計頁面布局,考慮相關數據
3) 設計數據信息,包括只讀性、UI類型、數據類型、變量名稱及其顯示信息
4) 設計權限規划
5) 編寫配置信息說明
4.3 編碼
編碼主要包括三部分內容:
1) 根據設計,開發添加和刪除模塊的腳本
2) 開發多語言支持的代碼
3) 根據業務需求,開發特定功能代碼
4.4 測試
使用開發工具添加/刪除模塊,按照測試計划測試。
4.5 部署
測試通過后,將模塊導出到.zip文件,在生產環境中導入該.zip文件。
5 項目實施需要做的工作
在基於vTigerCRM開發完成后,如果需要進行客戶化項目實施,需要注意如下內容:
5.1 記錄編碼規則
在“Settings>Customize Record Numbering”設置好編碼規則。
6 附錄1:實驗
6.1 增加一個模塊Systeo
參考:http://service.syncomni.com:10080/twiki/bin/view/Syncomni/VTigerCRMDevelopment
6.1.1 問題總結
問題1:添加數據時下拉框Systeo Type不顯示數據,編輯時可以顯示。
分析:
增加一個模塊Systeo的腳本代碼中,增加了picklist類型(類型編碼是15)的字段(field),生成代碼如下:
$field2 = new Vtiger_Field(); $field2->name = 'SysteoType'; $field2->label = 'Systeo Type'; $field2->columntype = 'VARCHAR(100)'; $field2->uitype = 15; $field2->typeofdata = 'V~O';// Varchar~Optional $block1->addField($field2); /** table and column are automatically set */
$field2->setPicklistValues( Array ('Employee', 'Trainee') ); |
紅字部分將會導致在數據庫表“vtiger_picklist”中增加一條記錄“SysteoType”,在頁面顯示時,系統將會查找表“vtiger_SysteoType”,實際的表名字是“vtiger_systeotype”。而數據庫中,表名字是大小寫敏感的,因此頁面不能顯示期待顯示的下拉框數據。
解決:修改表“vtiger_picklist”中name全部為小寫即可。
問題2:Setting>PickList Editor中,編輯Systeo的Picklist,顯示有2條記錄,但是值都是空白。
分析:
在AssignPicklistValues.tpl編譯生成的.php文件中,顯示list的代碼如下:
<select multiple id="availList" name="availList" class="small crmFormList" style="overflow:auto; height: 150px;width:200px;border:1px solid #666666;font-family:Arial, Helvetica, sans-serif;font-size:11px;"> <?php $_from = $this->_tpl_vars['PICKVAL']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['pick_val']): ?> <option value="<?php echo $this->_tpl_vars['pick_val']; ?> "><?php echo $this->_tpl_vars['pick_val']; ?> </option> <?php endforeach; endif; unset($_from); ?> </select> |
經過研究代碼,未發現任何問題。因此,打開日志調試,計划通過打印更多的信息進行跟蹤。打開日志后,發現數據顯示正常。猜測是某些代碼未及時更新到緩沖程序中。
6.2 增加新主菜單
功能:增加一個主菜單Finance,包含2個系統自帶的子菜單(模塊)Contact和Webmail。
實現:
1) 編輯文件parent_tabdata.php,在$parent_tab_info_array增加:9=>'Finance',在$parent_child_tab_rel_array增加9=>array(4,28)
2) 編輯include/language/en_us.lang.php,在$app_strings中增加’Finance’=>’Finance’
3) 編輯include/language/zh_cn.lang.php,在$app_strings中增加’Finance’=>’財務’
4) 刷新登錄頁面,出現Finance菜單,但是鼠標划過時沒有子菜單出現。
5) 往vtiger_parenttabrel和vtiger_parenttabrel增加對應數據
問題:到第4步,不能顯示子菜單,分析如下:
原因:在生成頁面時,沒有生成菜單層,例如對於Settings菜單,會生成菜單層Settings_sub,內容如下:
<div class="drop_mnu" id="Settings_sub" onmouseout="fnHideDrop('Settings_sub')" onmouseover="fnShowDrop('Settings_sub')"> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td><a href="index.php?module=Settings&action=index&parenttab=Settings" class="drop_down">Settings</a></td></tr>
<tr><td><a href="index.php?module=Settings&action=ModuleManager&parenttab=Settings" class="drop_down">Module Manager</a></td></tr> </table> </div> |
如上內容通過調用Header.tpl實現,內容如下:
<!-- Drop Down Menu in the Main Tab --> {foreach name=parenttablist key=parenttab item=details from=$QUICKACCESS} <div class="drop_mnu" id="{$parenttab}_sub" onmouseout="fnHideDrop('{$parenttab}_sub')" onmouseover="fnShowDrop('{$parenttab}_sub')"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> {foreach name=modulelist item=modules from=$details} {assign var="modulelabel" value=$modules[1]|@getTranslatedString:$modules[0]}
{* Use Custom module action if specified *} {assign var="moduleaction" value="index"} {if isset($modules[2])} {assign var="moduleaction" value=$modules[2]} {/if}
<tr><td><a href="index.php?module={$modules.0}&action={$moduleaction}&parenttab={$parenttab}" class="drop_down">{$modulelabel}</a></td></tr> {/foreach} </table> </div> {/foreach} |
上述代碼翻譯后的結果如下:
<!-- Drop Down Menu in the Main Tab --> <?php $_from = $this->_tpl_vars['QUICKACCESS']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['parenttablist'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['parenttablist']['total'] > 0): foreach ($_from as $this->_tpl_vars['parenttab'] => $this->_tpl_vars['details']): $this->_foreach['parenttablist']['iteration']++; ?> <div class="drop_mnu" id="<?php echo $this->_tpl_vars['parenttab']; ?> _sub" onmouseout="fnHideDrop('<?php echo $this->_tpl_vars['parenttab']; ?> _sub')" onmouseover="fnShowDrop('<?php echo $this->_tpl_vars['parenttab']; ?> _sub')"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <?php $_from = $this->_tpl_vars['details']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['modulelist'] = array('total' => count($_from), 'iteration' => 0); if ($this->_foreach['modulelist']['total'] > 0): foreach ($_from as $this->_tpl_vars['modules']): $this->_foreach['modulelist']['iteration']++; ?> |
count($_from)的值是8,並沒有將新增加的菜單Finance計算在內,因此需要研究為什么$_from只有8個元素。
$_from = $this->_tpl_vars['QUICKACCESS']是從函數getAllParenttabmoduleslist()獲取的值,如下:
$smarty->assign("QUICKACCESS",getAllParenttabmoduleslist()); |
該函數查詢了數據庫表vtiger_parenttabrel、vtiger_tab和vtiger_parenttabrel進行計算,SQL語句如下:
select name,tablabel,parenttab_label,vtiger_tab.tabid from vtiger_parenttabrel inner join vtiger_tab on vtiger_parenttabrel.tabid = vtiger_tab.tabid inner join vtiger_parenttab on vtiger_parenttabrel.parenttabid = vtiger_parenttab.parenttabid and vtiger_tab.presence in (0,2) order by vtiger_parenttab.sequence, vtiger_parenttabrel.sequence |
因此,除了在數據文件增加以外還需要往vtiger_parenttabrel和vtiger_parenttabrel增加對應數據,才能在鼠標划過主菜單時顯示子菜單。
6.3 為Project模塊增加字段
打開Project模塊,初始狀態下沒有數據,首次添加一個Project,將會提示如下信息:
Duplicate Project No - Click here to Configure the Project No |
原因:沒有配置項目編碼的規則,點擊“here”配置即可。
建議:在“Settings>Customize Record Numbering”設置好編碼規則。
7 附錄2:中文包完善
文件 |
文件操作 |
modules/SMSNotifier/language/zh_cn.lang.php |
添加 |
modules/Project/language/zh_cn.lang.php |
添加 |
Modules/Settings/language/zh_cn.lang.php |
修改 |
Settings
添加如下內容:
'LBL_PICKLIST_DEPENDENCY_SETUP' => '編輯下拉框依賴關系', 'LBL_PICKLIST_DEPENDENCY_DESCRIPTION' => '定制兩個下拉框之間的數據邏輯關系', |
8 附錄:Userful SQL
8.1 Picklist相關
select * from vtiger_picklist where name in (select fieldname from vtiger_field where tablename like '%cashj%' and uitype=15) |
9 附錄:新增uitype列表
uitype |
功能 |
修改文件 |
1028 |
DocLib文件上傳按鈕 |
Smarty\templates\EditViewUI.tpl:944~964 |
|
|
|