2
我是vtiger的新手。我试图从服务模块中的“服务名称”字段插入到TroubleTicket模块中,但到目前为止我无法做到这一点。
一般来说,是否可以从另一个模块中插入一个字段到模块中?如果是这样,它应该如何完成?vTiger - 如何在另一个模块中使用模块字段
我是vtiger的新手。我试图从服务模块中的“服务名称”字段插入到TroubleTicket模块中,但到目前为止我无法做到这一点。
一般来说,是否可以从另一个模块中插入一个字段到模块中?如果是这样,它应该如何完成?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'));
}
}
}
?>
无瑕的例子,谢谢你,顺便说一句,如果我需要不止一个领域像这种情况,但更多的领域,在这种情况下,我只是将它们添加到条件(如果(!$ fieldInstance) ? – NeoVe