vTiger语言 - 如何在另一个模块中使用模块字段



我是vtiger的新手。我正在尝试从故障排除单模块中的服务模块插入"服务名称"字段,但到目前为止我无法做到这一点。
一般来说,是否可以从另一个模块在模块中插入字段?如果是这样,应该如何做?

您可以使用此代码,将其放在vTiger根目录下并从浏览器调用它。

<?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'));
       }
  }
}
?>

最新更新