• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/settings/countersettings.php
  • Класс: Bitrix\Crm\Settings\CounterSettings
  • Вызов: CounterSettings::isLimitReached
private function isLimitReached(): bool
{
	if (!Bitrix24Manager::isEnabled())
	{
		return false;
	}

	if (!Bitrix24Manager::getVariable(self::MAX_ACTIVITIES_COUNT_VAR_NAME))
	{
		return false;
	}

	if ($this->useCache)
	{
		$cache = Application::getInstance()->getCache();
		if ($cache->initCache(self::LIMIT_CACHE_TTL, self::LIMIT_CACHE_ID, self::LIMIT_CACHE_PATH))
		{
			$result = $cache->getVars();
		}
		else
		{
			$result['TOTAL'] =  $this->getCounterCurrentValue();

			$cache->startDataCache();
			$cache->endDataCache($result);
		}
	}
	else
	{
		$result['TOTAL'] =  $this->getCounterCurrentValue();
	}

	$maxActivitiesCount = max(0, (int)$this->getCounterLimitValue());

	return $result['TOTAL'] > $maxActivitiesCount;
}