ProviderDecorator::prepareEntityData

  1. Bitrix24 API (v. 23.675.0)
  2. crmmobile
  3. ProviderDecorator
  4. prepareEntityData
  • Модуль: crmmobile
  • Путь к файлу: ~/bitrix/modules/crmmobile/lib/UI/EntityEditor/ProviderDecorator.php
  • Класс: Bitrix\CrmMobile\UI\EntityEditor\ProviderDecorator
  • Вызов: ProviderDecorator::prepareEntityData
private function prepareEntityData(array &$entityData): void
{
	$entityData['ENTITY_TYPE_ID'] = $this->getEntityTypeId();
	$entityData['ID'] = $this->isCopyMode() ? $this->getEntityId() : 0;
	$entityData['DESTINATION_ID'] = $this->isCopyMode() ? 0 : $this->getEntityId();
	$entityData['CATEGORY_ID'] = $this->getCategoryId();

	$aliasMap = $this->getAliasFieldNames();

	foreach ($this->getDisplayFields() as $displayName => $field)
	{
		$displayValue = null;
		$aliasName = $aliasMap[$displayName] ?? null;

		if ($aliasName !== null)
		{
			$displayValue = $this->displayItem[$aliasName]['value'] ?? null;
		}

		if ($displayValue === null)
		{
			$displayValue = $this->displayItem[$displayName]['value'] ?? null;
		}

		$entityData[$displayName] = $displayValue;

		if ($aliasName !== null)
		{
			$entityData[$aliasMap[$displayName]] = $displayValue;
		}
	}

	$entityData = $this->prepareStageFieldValue($entityData);
	$entityData = $this->prepareFmValues($entityData);
	$entityData = $this->prepareOpportunityField($entityData);
	$entityData = $this->prepareProductRowSummary($entityData);
	$entityData = $this->prepareRequisiteValues($entityData);
	$entityData = $this->prepareAddressFieldForLeads($entityData);
	$entityData = $this->prepareLocationField($entityData);

	if (empty($entityData['ID']))
	{
		$entityData['ID'] = null;
	}

	if ($this->isCopyMode())
	{
		if ($this->getEntityTypeId() === \CCrmOwnerType::Quote)
		{
			unset($entityData[Item\Quote::FIELD_NAME_NUMBER]);
		}
		elseif ($this->getEntityTypeId() === \CCrmOwnerType::SmartInvoice)
		{
			unset($entityData[Item\SmartInvoice::FIELD_NAME_ACCOUNT_NUMBER]);
		}
	}
}

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