Exemplo n.º 1
0
$arResult['ENTITY_ID'] = isset($_REQUEST['entity_id']) ? $_REQUEST['entity_id'] : $arParams['FIELS_ENTITY_ID'];
$arResult['FIELD_ID'] = isset($_REQUEST['field_id']) ? $_REQUEST['field_id'] : $arParams['FIELS_FIELD_ID'];
global $USER_FIELD_MANAGER;
$CCrmFields = new CCrmFields($USER_FIELD_MANAGER, $arResult['ENTITY_ID']);
if ($CCrmFields->CheckError()) {
    $ex = $APPLICATION->GetException();
    ShowError($ex->GetString());
    return;
}
$arResult['DISABLE_MULTIPLE'] = false;
$arResult['NEW_FIELD'] = false;
if (!$arResult['FIELD_ID']) {
    $arResult['NEW_FIELD'] = true;
}
$arResult['FIELD'] = array();
if (!$arResult['NEW_FIELD'] && !($arResult['FIELD'] = $CCrmFields->GetByName($arResult['FIELD_ID']))) {
    ShowError(GetMessage('CRM_FIELDS_EDIT_WRONG_FIELD'));
    return;
}
if (isset($arResult['FIELD']['ID'])) {
    //HACK: is required for obtain a multilang support for EDIT_FORM_LABEL
    $fieldData = CUserTypeEntity::GetByID($arResult['FIELD']['ID']);
    if ($fieldData) {
        $arResult['FIELD']['EDIT_FORM_LABEL'] = $fieldData['EDIT_FORM_LABEL'];
        $arResult['FIELD']['LIST_COLUMN_LABEL'] = $fieldData['LIST_COLUMN_LABEL'];
        $arResult['FIELD']['LIST_FILTER_LABEL'] = $fieldData['LIST_FILTER_LABEL'];
        $arResult['FIELD']['ERROR_MESSAGE'] = $fieldData['ERROR_MESSAGE'];
        $arResult['FIELD']['HELP_MESSAGE'] = $fieldData['HELP_MESSAGE'];
    }
}
$arResult['GRID_ID'] = 'field_list';