2013-09-03 2 views
3

내 작업 내에서 editviewdefs.php ...이 작업에 적합합니다. 필드가 읽기 전용이며 편집 할 수 없습니다. 누군가가 '유형'=> '읽기 전용'을 사용자 역할이 '대출 담당자'와 일치하는 경우에만 적용하도록 도와 줄 수 있습니까?사용자 역할을 기반으로 사용자 정의 필드를 읽기 전용으로 만듭니다.

array (
     0 => '', 
     1 => 
     array (
     'name' => 'processor_signoff_c', 
     'label' => 'LBL_PROCESSOR_SIGNOFF', 
     'type' => 'readonly', 
    ), 
    ), 

6.5.14 Community Edition을 사용하고 있습니다.

답변

2

다음 용액 같을 수

파일 => 맞춤/모듈/태스크 /보기/view.edit.php

/** 
* @see SugarView::display() 
*/ 
public function display() 
{ 
    if($this->ev->isDuplicate){ 
      $this->bean->status = $this->bean->getDefaultStatus(); 
    } //if 

    global $current_user; 

    // check if current user is in specific role 
      $isEnabledRole = in_array("ITOperation", ACLRole::getUserRoleNames($current_user->id)); 
      if($isEnabledRole) 
       $this->ev->ss->assign('readOnly', 'readonly = "readonly"'); 
      else 
       $this->ev->ss->assign('readOnly', ''); 

    parent::display(); 
} 

파일 => 맞춤/모듈/태스크/메타/editviewdefs을 .PHP

다음 확인란 입력 유형에 대해
array (

     array (
     'name' => 'description', 
    'customCode' => '<input type="text" title="" value="{$fields.description.value}" id="description" name="description" {$readOnly}>', 
    ), 
    ), 
), 

: 파일 => 사용자 정의/모듈/작업/뷰/view.edit.php

  if($isEnabledRole) { 
       $this->ev->ss->assign('readOnly', 'readonly = "readonly"'); 
       $this->ev->ss->assign('disabled', 'disabled'); 
      } else { 
       $this->ev->ss->assign('readOnly', ''); 
       $this->ev->ss->assign('disabled', ''); 
      } 

파일 => 사용자 정의/모듈/작업/메타 데이터/editviewdefs.php

 array (
     'name' => 'processor_signoff_c', 
     'label' => 'LBL_PROCESSOR_SIGNOFF', 
     'customCode' => '<input type="hidden" name="processor_signoff_c" value="0"><input type="checkbox" id="processor_signoff_c" name="processor_signoff_c" value="1" {if $fields.processor_signoff_c.value == "1"} checked {/if} {$disabled}>', 
    ), 

안녕, 안토니오.

+0

실제로 동일한 예제가 있지만 그 유일한 문제점은 구문을 사용할 수 없다는 것입니다. 내 값은 value = "{$ fields.processor_signoff_c.value}"이며 올바른 값을 삽입하거나 저장시 데이터베이스에 제대로 저장하지 않습니다. 구문이 올바르게 작동하도록 도울 수 있다면 ... 좋은 대답으로 표시 할 수 있습니다. – faldeland

+0

이제 답이 통합되어 있으면 테스트가 완료되었습니다. 안녕. –

+0

당신의 공헌에 너무 감사드립니다 ... 나는 오늘 나중에 테스트하고 다시보고 할 것입니다 ... 나는 당신이 가고있는 곳을보고 그것이 트릭을 한 – faldeland

관련 문제