【问题标题】:vTiger - How to use module field in another modulevTiger - 如何在另一个模块中使用模块字段
【发布时间】:2012-12-13 11:34:31
【问题描述】:

我是 vtiger 的新手。我正在尝试在 TroubleTicket 模块的服务模块中插入字段“服务名称”,但到目前为止我还无法做到。
一般来说,是否可以在另一个模块的模块中插入字段?如果有,应该怎么做?

【问题讨论】:

    标签: vtiger


    【解决方案1】:

    您可以使用此代码,将其放在您的 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'));
           }
      }
    }
    ?>
    

    【讨论】:

    • 完美示例,谢谢,顺便说一句,如果我需要像这种情况下的多个字段,但需要更多字段,在这种情况下,我只需将它们添加到条件 (if(!$fieldInstance)?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-30
    • 2016-02-27
    • 2019-02-19
    相关资源
    最近更新 更多