• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/automation/factory.php
  • Класс: Bitrix\Crm\Automation\Factory
  • Вызов: Factory::isOverLimited
static function isOverLimited($entityTypeId): bool
{
	$limit = static::getRobotsLimit($entityTypeId);

	if ($limit <= 0)
	{
		return false;
	}

	if (isset(self::$limitationCache[$entityTypeId]))
	{
		return self::$limitationCache[$entityTypeId];
	}

	$target = self::createTarget($entityTypeId);
	$statuses = $target->getEntityStatuses();

	$triggersCnt = count($target->getTriggers($statuses));

	if ($triggersCnt > $limit)
	{
		return self::$limitationCache[$entityTypeId] = true;
	}

	$documentType = \CCrmBizProcHelper::ResolveDocumentType($entityTypeId);
	$robotsCnt = \Bitrix\Bizproc\Automation\Helper::countAllRobots($documentType, $statuses);

	return self::$limitationCache[$entityTypeId] = ($triggersCnt + $robotsCnt > $limit);
}