解决方案可能如下:
文件 => 自定义/模块/任务/视图/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}>',
),
再见,安东尼奥。