CCrmDocumentContact::getEntityFields

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmDocumentContact
  4. getEntityFields
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_document_contact.php
  • Класс: \CCrmDocumentContact
  • Вызов: CCrmDocumentContact::getEntityFields
static function getEntityFields($entityType)
{
	\Bitrix\Main\Localization\Loc::loadMessages($_SERVER['DOCUMENT_ROOT'].BX_ROOT.'/components/bitrix/crm.'.
		mb_strtolower($entityType).'.edit/component.php');

	$addressLabels = Bitrix\Crm\EntityAddress::getShortLabels();
	$printableFieldNameSuffix = ' ('.GetMessage('CRM_FIELD_BP_TEXT').')';

	$arResult = static::getVirtualFields() + array(
		'ID' => array(
			'Name' => GetMessage('CRM_FIELD_ID'),
			'Type' => 'int',
			'Filterable' => true,
			'Editable' => false,
			'Required' => false,
		),
		'NAME' => array(
			'Name' => GetMessage('CRM_FIELD_FIRST_NAME'),
			'Type' => 'string',
			'Filterable' => true,
			'Editable' => true,
			'Required' => true,
		),
		'LAST_NAME' => array(
			'Name' => GetMessage('CRM_FIELD_LAST_NAME'),
			'Type' => 'string',
			'Filterable' => true,
			'Editable' => true,
			'Required' => true,
		),
		'SECOND_NAME' => array(
			'Name' => GetMessage('CRM_FIELD_SECOND_NAME'),
			'Type' => 'string',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'HONORIFIC' => array(
			'Name' => GetMessage('CRM_FIELD_HONORIFIC'),
			'Type' => 'select',
			'Options' => CCrmStatus::GetStatusListEx('HONORIFIC'),
			'Editable' => true,
			'Required' => false,
		),
		'BIRTHDATE' => array(
			'Name' => GetMessage('CRM_FIELD_BIRTHDATE'),
			'Type' => 'date',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'PHOTO' => array(
			'Name' => GetMessage('CRM_FIELD_PHOTO'),
			'Type' => 'file',
			'Filterable' => false,
			'Editable' => true,
			'Required' => false,
		),
		'EMAIL' => array(
			'Name' => GetMessage('CRM_FIELD_EMAIL'),
			'Type' => 'email',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'PHONE' => array(
			'Name' => GetMessage('CRM_FIELD_PHONE'),
			'Type' => 'phone',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'WEB' => array(
			'Name' => GetMessage('CRM_FIELD_WEB'),
			'Type' => 'web',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'IM' => array(
			'Name' => GetMessage('CRM_FIELD_MESSENGER'),
			'Type' => 'im',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'POST' => array(
			'Name' => GetMessage('CRM_FIELD_POST'),
			'Type' => 'string',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'FULL_ADDRESS' => array(
			'Name' => GetMessage('CRM_FIELD_ADDRESS'),
			'Type' => 'text',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'ADDRESS' => array(
			'Name' => $addressLabels['ADDRESS'],
			'Type' => 'text',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'ADDRESS_2' => array(
			'Name' => $addressLabels['ADDRESS_2'],
			'Type' => 'text',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'ADDRESS_CITY' => array(
			'Name' => $addressLabels['CITY'],
			'Type' => 'text',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'ADDRESS_POSTAL_CODE' => array(
			'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' => array(
			'Name' => $addressLabels['PROVINCE'],
			'Type' => 'text',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'ADDRESS_COUNTRY' => array(
			'Name' => $addressLabels['COUNTRY'],
			'Type' => 'text',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'COMMENTS' => array(
			'Name' => GetMessage('CRM_FIELD_COMMENTS'),
			'Type' => 'text',
			'ValueContentType' => 'bb',
			'Filterable' => false,
			'Editable' => true,
			'Required' => false,
		),
		'TYPE_ID' => array(
			'Name' => GetMessage('CRM_FIELD_TYPE_ID'),
			'Type' => 'select',
			'Options' => CCrmStatus::GetStatusListEx('CONTACT_TYPE'),
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
		'ASSIGNED_BY_ID' => array(
			'Name' => GetMessage('CRM_FIELD_ASSIGNED_BY_ID'),
			'Type' => 'user',
			'Filterable' => true,
			'Editable' => true,
			'Required' => false,
		),
	);

	$arResult += parent::getAssignedByFields();
	$arResult += array(
		'CREATED_BY_ID' => [
			'Name' => GetMessage('CRM_DOCUMENT_FIELD_CREATED_BY_ID_CONTACT'),
			'Type' => 'user',
		],
		'MODIFY_BY_ID' => [
			'Name' => GetMessage('CRM_DOCUMENT_FIELD_MODIFY_BY_ID'),
			'Type' => 'user',
		],
		'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,
		],
		"OPENED" => [
			"Name" => GetMessage("CRM_FIELD_OPENED"),
			"Type" => "bool",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		],
		"EXPORT" => [
			"Name" => GetMessage("CRM_FIELD_EXPORT"),
			"Type" => "bool",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		],
		"COMPANY_ID" => [
			"Name" => GetMessage("CRM_FIELD_COMPANY_ID"),
			"Type" => "string",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		],
		"COMPANY_IDS" => [
			"Name" => GetMessage("CRM_FIELD_COMPANY_IDS"),
			"Type" => "string",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
			"Multiple" => true
		],
		"LEAD_ID" => [
			"Name" => GetMessage("CRM_FIELD_LEAD_ID"),
			"Type" => "int",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		],
		"ORIGINATOR_ID" => [
			"Name" => GetMessage("CRM_FIELD_ORIGINATOR_ID"),
			"Type" => "string",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		],
		"ORIGIN_ID" => [
			"Name" => GetMessage("CRM_FIELD_ORIGIN_ID"),
			"Type" => "string",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		],
		"DATE_CREATE" => [
			"Name" => GetMessage("CRM_CONTACT_EDIT_FIELD_DATE_CREATE"),
			"Type" => "datetime",
			"Filterable" => true,
			"Editable" => false,
			"Required" => false,
		],
		"DATE_MODIFY" => [
			"Name" => GetMessage("CRM_CONTACT_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,
		],
		'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_CONTACT');
	$CCrmUserType->AddBPFields($arResult, array('PRINTABLE_SUFFIX' => GetMessage("CRM_FIELD_BP_TEXT")));

	//append UTM fields
	$arResult += parent::getUtmFields();

	//append FORM fields
	$arResult += parent::getSiteFormFields(CCrmOwnerType::Contact);

	return $arResult;
}

Добавить комментарий