Delivery::onDeliveryRequestCreated

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Delivery
  4. onDeliveryRequestCreated
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/delivery.php
  • Класс: Bitrix\Crm\Activity\Provider\Delivery
  • Вызов: Delivery::onDeliveryRequestCreated
static function onDeliveryRequestCreated(Event $event): void
{
	/** @var Requests\Result $result */
	$result = $event->getParameter('RESULT');

	/** @var array $additional */
	$additional = $event->getParameter('ADDITIONAL');

        /** @var RequestResult|null $requestResult */
        $requestResult = null;

	$requestResults = $result->getRequestResults();
	if ($result->isSuccess() && !empty($requestResults))
	{
            $requestResult = $requestResults[0];
	}

	if (
		isset($additional['ACTIVITY_ID'])
		&& ($activity = self::getActivity(['ID' => (int)$additional['ACTIVITY_ID']]))
	)
	{
		\CCrmActivity::update(
			$activity['ID'],
			[
                    'ASSOCIATED_ENTITY_ID' => $requestResult ? $requestResult->getInternalId() : null,
                ],
			false
		);
	}
}

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