提到到PHP OpenSource CRM大家應該比較會想到的會是VtigerCRM與SugarCRM,不過後來因為SugarCRM停止開源而且比較龐大,就很少使用,關於SuiteCRM容我下次再說明清楚,此次因為我想要在SuiteCRM加入JavaScript做些應用,怕以後忘記先記錄一下!
1.找到要修改的功能(Model)進入底下頁面
例如:我想在Leads這個模組的編輯頁面,引入JS,就可以這樣做:
進入/modules/Leads/metadata找到editviewdefs.php,進行調整.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
...SuiteCRM主目錄/modules/某個模組/metadata找到想修加入JS的頁面 array( 'EditView' => array( 'templateMeta' => array( 'form' => array( 'hidden' => array( 0 => '<input type="hidden" name="prospect_id" value="{if isset($smarty.request.prospect_id)}{$smarty.request.prospect_id}{else}{$bean->prospect_id}{/if}">', 1 => '<input type="hidden" name="account_id" value="{if isset($smarty.request.account_id)}{$smarty.request.account_id}{else}{$bean->account_id}{/if}">', 2 => '<input type="hidden" name="contact_id" value="{if isset($smarty.request.contact_id)}{$smarty.request.contact_id}{else}{$bean->contact_id}{/if}">', 3 => '<input type="hidden" name="opportunity_id" value="{if isset($smarty.request.opportunity_id)}{$smarty.request.opportunity_id}{else}{$bean->opportunity_id}{/if}">', ), 'buttons' => array( 0 => 'SAVE', 1 => 'CANCEL', ), ), ..........(略) 1 => array( 'label' => '10', 'field' => '30', ), ), 這邊會有好幾層要注意擺放位置 'includes'=> array( 0 => array( 'file' => '要引入的JS路徑', ), ), ............(略) |
2.這樣就完成JS引入,可以實際測試看看有沒引入正確的JS!