• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/scrum/service/robotservice.php
  • Класс: BitrixTasksScrumServiceRobotService
  • Вызов: RobotService::hasRobots
public function hasRobots(int $groupId, array $stageIds): bool
{
	$projectDocumentType = BizprocDocumentTask::resolveScrumProjectTaskType($groupId);
	$currentDocumentType = ['tasks', BizprocDocumentTask::class, $projectDocumentType];

	$helper = new BitrixBizprocCopyIntegrationHelper($currentDocumentType);

	$robotIds = $helper->getWorkflowTemplateIds();
	$triggerIds = $helper->getTriggerIds();

	if (empty($robotIds) && empty($triggerIds))
	{
		return false;
	}

	$has = false;
	$queryResult = CBPWorkflowTemplateLoader::getList(
		[],
		['ID' => $robotIds],
		false,
		false,
		['DOCUMENT_STATUS']
	);
	while ($fields = $queryResult->fetch())
	{
		if (in_array($fields['DOCUMENT_STATUS'], $stageIds))
		{
			$has = true;

			break;
		}
	}

	if ($has)
	{
		return true;
	}

	$queryResult = TriggerTable::getList(
		[
			'select' => ['DOCUMENT_STATUS'],
			'filter' => ['=ID' => $triggerIds]
		]
	);
	while ($fields = $queryResult->fetch())
	{
		if (in_array($fields['DOCUMENT_STATUS'], $stageIds))
		{
			$has = true;

			break;
		}
	}

	return $has;
}