- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/automation/tunnelmanager.php
- Класс: Bitrix\Crm\Automation\TunnelManager
- Вызов: TunnelManager::prepareRobotToTunnel
protected function prepareRobotToTunnel(Robot $robot, string $stageId, int $categoryId): ?array
{
$props = $robot->getProperties();
if (!is_numeric($props['CategoryId']) || $categoryId === (int)$props['CategoryId'])
{
return null;
}
if (empty($props['StageId']))
{
$target = Factory::createTarget($this->entityTypeId);
$stages = array_keys($target->getStatusInfos($props['CategoryId']));
$props['StageId'] = reset($stages);
}
if (\CBPDocument::isExpression($props['StageId']))
{
return null;
}
return [
'srcCategory' => $categoryId,
'srcStage' => $stageId,
'dstCategory' => $props['CategoryId'],
'dstStage' => $props['StageId'],
'robotAction' => $this->getRobotAction($robot),
'robot' => $robot->toArray()
];
}