• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/restriction/webformresultsrestriction.php
  • Класс: Bitrix\Crm\Restriction\WebFormResultsRestriction
  • Вызов: WebFormResultsRestriction::processLimit
protected function processLimit(): bool
{
	$limit = (int)$this->resultsLimit;
	if ($limit <= 0)
	{
		return false;
	}

	$startDate = $this->startDate;
	if ($startDate !== null && (new Date())->getTimestamp() <= $startDate->getTimestamp())
	{
		return false;
	}
	$optionName = static::IS_LIMIT_REACHED_OPTION_PREFIX . $this->resultsLimit;
	$optionValue = $this->option::get('crm', $optionName);
	if ($optionValue === static::IS_LIMIT_REACHED_OPTION_VALUE)
	{
		return true;
	}

	$count = $this->resultEntityTable::getCountOfUniqueResultIds();
	$isLimitReached = ($count >= $this->resultsLimit);

	if ($isLimitReached)
	{
		$this->option::set('crm', $optionName, static::IS_LIMIT_REACHED_OPTION_VALUE);
	}

	return $isLimitReached;
}