• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/automation/engine/templatestunnel.php
  • Класс: BitrixBizprocAutomationEngineTemplatesTunnel
  • Вызов: TemplatesTunnel::moveRobots
public function moveRobots(array $robotNames, int $userId): Result
{
	if ($this->srcTemplate->isExternalModified() || $this->dstTemplate->isExternalModified())
	{
		$result = new Result();
		$result->setData([
			'moved' => [],
			'denied' => [],
		]);

		return $result;
	}

	$result = new Result();
	$copyingResult = $this->copyRobots($robotNames, $userId);

	if ($copyingResult->isSuccess())
	{
		$deletingResult = $this->srcTemplate->deleteRobots($copyingResult->getData()['copied'], $userId);

		if ($deletingResult->isSuccess())
		{
			$result->setData([
				'moved' => $copyingResult->getData()['copied'],
				'denied' => $copyingResult->getData()['denied'],
			]);
		}
		else
		{
			$result->addErrors($deletingResult->getErrors());
		}
	}
	else
	{
		$result->addErrors($copyingResult->getErrors());
	}

	return $result;
}