vTiger - How to use module field in another module

我的未来我决定 提交于 2019-12-07 19:43:18

问题


I'm newbie in vtiger. I'm trying to insert the field "Service Name" from Services module in TroubleTicket module, but up to now I wasn't able to do it.
Generally speaking, is it possible to insert a field in a Module from another module? If so, how is it supposed to be done?


回答1:


You can use this Code, Put this under your vTiger root directory and call it from browser.

<?php
$Vtiger_Utils_Log = true;

include_once('vtlib/Vtiger/Menu.php');
include_once('vtlib/Vtiger/Module.php');

$module = Vtiger_Module::getInstance('HelpDesk');
if($module) {
$blockInstance = Vtiger_Block::getInstance('LBL_TICKET_INFORMATION', $module);

    if($blockInstance) {

    $fieldInstance = Vtiger_Field::getInstance('Service1', $module);

       if(!$fieldInstance) {
           $fieldInstance = new Vtiger_Field();
           $fieldInstance->name = 'Service1';
           $fieldInstance->label = 'Service Name';
           $fieldInstance->uitype = 10;
           $fieldInstance->typeofdata = 'V~O';
           $blockInstance->addField($fieldInstance);

           $fieldInstance->setRelatedModules(Array('Services'));
       }
  }
}
?>



来源:https://stackoverflow.com/questions/13858958/vtiger-how-to-use-module-field-in-another-module

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!