2012-12-13 2 views
2

나는 vtiger에서 초보자입니다. TroubleTicket 모듈의 Services 모듈에서 "Service Name"필드를 삽입하려고합니다. 그러나 지금까지는 할 수 없었습니다.
일반적으로 다른 모듈의 모듈에 필드를 삽입 할 수 있습니까? 그렇다면 어떻게해야합니까?vTiger - 다른 모듈에서 모듈 필드를 사용하는 방법

답변

5

이 코드를 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')); 
     } 
    } 
} 
?> 

+0

흠 예를 들어, 난 그냥 (조건에 추가하는 경우,이 경우처럼,하지만 더 필드 경우 (! $ fieldInstance) 두 개 이상의 필드를 필요 BTW 경우, 감사합니다 ? – NeoVe

관련 문제