3

在我的任务中 editviewdefs.php ...这对我有用。该字段是只读的,不能编辑。有人可以帮我使“类型”=>“只读”仅在用户角色与“贷款官”匹配的情况下适用吗?

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

我正在使用 6.5.14 社区版。

4

1 回答 1

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}>',
      ),
    ),
  ),

然后对于复选框输入类型: File => custom/modules/Tasks/views/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}>',
      ),

再见,安东尼奥。

于 2013-09-03T12:23:43.587 回答