• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Item/Factory/HistoryItemStoreDocument.php
  • Класс: Bitrix\Crm\Service\Timeline\Item\Factory\HistoryItemStoreDocument
  • Вызов: HistoryItemStoreDocument::getStoreDocumentCreationItem
static function getStoreDocumentCreationItem(Context $context, Model $model): ?Item
{
	$documentType = $model->getAssociatedEntityModel()->get('DOC_TYPE');
	if (!$documentType)
	{
		return null;
	}

	$map = [
		StoreDocument::TYPE_ARRIVAL => Item\LogMessage\StoreDocument\Creation\Arrival::class,
		StoreDocument::TYPE_STORE_ADJUSTMENT => Item\LogMessage\StoreDocument\Creation\StoreAdjustment::class,
		StoreDocument::TYPE_MOVING => Item\LogMessage\StoreDocument\Creation\Moving::class,
		StoreDocument::TYPE_DEDUCT => Item\LogMessage\StoreDocument\Creation\Deduct::class,
		StoreDocument::TYPE_SALES_ORDERS => Item\LogMessage\StoreDocument\Creation\Realization::class,
	];

	if (!isset($map[$documentType]))
	{
		return null;
	}

	/** @var Item $className */
	$className = $map[$documentType];

	return new $className($context, $model);
}