static function getEntityFields($entityType)
{
\Bitrix\Main\Localization\Loc::loadMessages($_SERVER['DOCUMENT_ROOT'].BX_ROOT.'/components/bitrix/crm.'.
mb_strtolower($entityType).'.edit/component.php');
$addressLabels = Crm\EntityAddress::getShortLabels();
$printableFieldNameSuffix = ' ('.GetMessage('CRM_FIELD_BP_TEXT').')';
$arResult = static::getVirtualFields() + [
'ID' => [
'Name' => GetMessage('CRM_FIELD_ID'),
'Type' => 'int',
'Filterable' => true,
'Editable' => false,
'Required' => false,
],
'TITLE' => [
'Name' => GetMessage('CRM_FIELD_TITLE_LEAD'),
'Type' => 'string',
'Filterable' => true,
'Editable' => true,
'Required' => true,
],
'STATUS_ID' => [
'Name' => CCrmLead::GetFieldCaption('STATUS_ID'),
'Type' => 'select',
'Options' => CCrmStatus::GetStatusListEx('STATUS'),
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'STATUS_ID_PRINTABLE' => [
'Name' => CCrmLead::GetFieldCaption('STATUS_ID') . $printableFieldNameSuffix,
'Type' => 'string',
'Filterable' => false,
'Editable' => false,
'Required' => false,
],
'STATUS_DESCRIPTION' => [
'Name' => CCrmLead::GetFieldCaption('STATUS_DESCRIPTION'),
'Type' => 'text',
'Filterable' => false,
'Editable' => true,
'Required' => false,
],
"OPENED" => [
"Name" => GetMessage("CRM_FIELD_OPENED"),
"Type" => "bool",
"Filterable" => true,
"Editable" => true,
"Required" => false,
],
'OPPORTUNITY' => [
'Name' => GetMessage('CRM_FIELD_OPPORTUNITY'),
'Type' => 'string',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'CURRENCY_ID' => [
'Name' => GetMessage('CRM_FIELD_CURRENCY_ID'),
'Type' => 'select',
'Options' => CCrmCurrencyHelper::PrepareListItems(),
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'ASSIGNED_BY_ID' => [
'Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID'),
'Type' => 'user',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
];
$arResult += parent::getAssignedByFields();
$arResult += [
'CREATED_BY_ID' => [
'Name' => GetMessage('CRM_FIELD_CREATED_BY_ID'),
'Type' => 'user',
'Filterable' => true,
'Editable' => false,
'Required' => false,
],
'CREATED_BY_PRINTABLE' => [
'Name' => GetMessage('CRM_FIELD_CREATED_BY_ID').$printableFieldNameSuffix,
'Type' => 'string',
'Filterable' => false,
'Editable' => false,
'Required' => false,
],
'MODIFY_BY_ID' => [
'Name' => GetMessage('CRM_DOCUMENT_FIELD_MODIFY_BY_ID'),
'Type' => 'user',
],
'COMMENTS' => [
'Name' => GetMessage('CRM_FIELD_COMMENTS'),
'Type' => 'text',
'ValueContentType' => 'bb',
'Filterable' => false,
'Editable' => true,
'Required' => false,
],
"OBSERVER_IDS" => [
"Name" => GetMessage("CRM_FIELD_OBSERVER_IDS"),
"Type" => "user",
"Filterable" => true,
"Editable" => false,
"Required" => false,
"Multiple" => true,
],
'NAME' => [
'Name' => GetMessage('CRM_LEAD_FIELD_NAME'),
'Type' => 'string',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'LAST_NAME' => [
'Name' => GetMessage('CRM_FIELD_LAST_NAME'),
'Type' => 'string',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'SECOND_NAME' => [
'Name' => GetMessage('CRM_FIELD_SECOND_NAME'),
'Type' => 'string',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'HONORIFIC' => [
'Name' => GetMessage('CRM_FIELD_HONORIFIC'),
'Type' => 'select',
'Options' => CCrmStatus::GetStatusListEx('HONORIFIC'),
'Editable' => true,
'Required' => false,
],
'BIRTHDATE' => [
'Name' => GetMessage('CRM_LEAD_EDIT_FIELD_BIRTHDATE'),
'Type' => 'datetime',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'EMAIL' => [
'Name' => GetMessage('CRM_FIELD_EMAIL'),
'Type' => 'email',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'PHONE' => [
'Name' => GetMessage('CRM_FIELD_PHONE'),
'Type' => 'phone',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'WEB' => [
'Name' => GetMessage('CRM_FIELD_WEB'),
'Type' => 'web',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'IM' => [
'Name' => GetMessage('CRM_FIELD_MESSENGER'),
'Type' => 'im',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'COMPANY_TITLE' => [
'Name' => GetMessage('CRM_FIELD_COMPANY_TITLE'),
'Type' => 'string',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'POST' => [
'Name' => GetMessage('CRM_FIELD_POST'),
'Type' => 'string',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'FULL_ADDRESS' => [
'Name' => GetMessage('CRM_FIELD_ADDRESS'),
'Type' => 'text',
'Filterable' => false,
'Editable' => false,
'Required' => false,
],
'ADDRESS' => [
'Name' => $addressLabels['ADDRESS'],
'Type' => 'text',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'ADDRESS_2' => [
'Name' => $addressLabels['ADDRESS_2'],
'Type' => 'text',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'ADDRESS_CITY' => [
'Name' => $addressLabels['CITY'],
'Type' => 'text',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'ADDRESS_POSTAL_CODE' => [
'Name' => $addressLabels['POSTAL_CODE'],
'Type' => 'text',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'ADDRESS_REGION' => array(
'Name' => $addressLabels['REGION'],
'Type' => 'text',
'Filterable' => true,
'Editable' => true,
'Required' => false,
),
'ADDRESS_PROVINCE' => [
'Name' => $addressLabels['PROVINCE'],
'Type' => 'text',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'ADDRESS_COUNTRY' => [
'Name' => $addressLabels['COUNTRY'],
'Type' => 'text',
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'SOURCE_ID' => [
'Name' => GetMessage('CRM_FIELD_SOURCE_ID'),
'Type' => 'select',
'Options' => CCrmStatus::GetStatusListEx('SOURCE'),
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
'SOURCE_DESCRIPTION' => [
'Name' => GetMessage('CRM_FIELD_SOURCE_DESCRIPTION'),
'Type' => 'text',
'Filterable' => false,
'Editable' => true,
'Required' => false,
],
"DATE_CREATE" => [
"Name" => GetMessage("CRM_LEAD_EDIT_FIELD_DATE_CREATE"),
"Type" => "datetime",
"Filterable" => true,
"Editable" => false,
"Required" => false,
],
"DATE_MODIFY" => [
"Name" => GetMessage("CRM_LEAD_EDIT_FIELD_DATE_MODIFY"),
"Type" => "datetime",
"Filterable" => true,
"Editable" => false,
"Required" => false,
],
'WEBFORM_ID' => [
'Name' => GetMessage('CRM_DOCUMENT_WEBFORM_ID'),
'Type' => 'select',
'Options' => static::getWebFormSelectOptions(),
'Filterable' => false,
'Editable' => false,
'Required' => false,
],
'IS_RETURN_CUSTOMER' => [
'Name' => GetMessage('CRM_DOCUMENT_LEAD_IS_RETURN_CUSTOMER'),
'Type' => 'bool',
'Editable' => false,
],
"CONTACT_ID" => [
"Name" => GetMessage("CRM_DOCUMENT_CRM_ENTITY_TYPE_CONTACT"),
"Type" => "UF:crm",
"Options" => ['CONTACT' => 'Y'],
],
"CONTACT_IDS" => [
"Name" => GetMessage("CRM_DOCUMENT_FIELD_CONTACT_IDS"),
"Type" => "UF:crm",
"Options" => ['CONTACT' => 'Y'],
"Multiple" => true,
],
"COMPANY_ID" => [
"Name" => GetMessage("CRM_DOCUMENT_CRM_ENTITY_TYPE_COMPANY"),
"Type" => "UF:crm",
"Options" => ['COMPANY' => 'Y'],
],
'TRACKING_SOURCE_ID' => [
'Name' => GetMessage('CRM_DOCUMENT_FIELD_TRACKING_SOURCE_ID'),
'Type' => 'select',
'Options' => array_column(Crm\Tracking\Provider::getActualSources(), 'NAME','ID'),
'Filterable' => true,
'Editable' => true,
'Required' => false,
],
];
$arResult += static::getCommunicationFields();
$ar = CCrmFieldMulti::GetEntityTypeList();
foreach ($ar as $typeId => $arFields)
{
$arResult[$typeId.'_PRINTABLE'] = array(
'Name' => GetMessage('CRM_FIELD_MULTI_'.$typeId).$printableFieldNameSuffix,
'Type' => 'string',
"Filterable" => true,
"Editable" => false,
"Required" => false,
);
foreach ($arFields as $valueType => $valueName)
{
$arResult[$typeId.'_'.$valueType] = array(
'Name' => $valueName,
'Type' => 'string',
"Filterable" => true,
"Editable" => false,
"Required" => false,
);
$arResult[$typeId.'_'.$valueType.'_PRINTABLE'] = array(
'Name' => $valueName.$printableFieldNameSuffix,
'Type' => 'string',
"Filterable" => true,
"Editable" => false,
"Required" => false,
);
}
}
global $USER_FIELD_MANAGER;
$CCrmUserType = new CCrmUserType($USER_FIELD_MANAGER, 'CRM_LEAD');
$CCrmUserType->AddBPFields($arResult, array('PRINTABLE_SUFFIX' => GetMessage("CRM_FIELD_BP_TEXT")));
//append UTM fields
$arResult += parent::getUtmFields();
//append FORM fields
$arResult += parent::getSiteFormFields(CCrmOwnerType::Lead);
return $arResult;
}