• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/limits.php
  • Класс: BitrixVoximplantLimits
  • Вызов: Limits::getRemainingRecordsCount
static function getRemainingRecordsCount()
{
	$recordLimit = static::getRecordLimit();
	if(!$recordLimit)
	{
		return 0;
	}

	$recordMonth = Option::get("voximplant", "record_month");
	$currentMonth = date('Ym');

	if (!$recordMonth)
	{
		Option::set("voximplant", "record_month", $currentMonth);
		CGlobalCounter::Set('vi_records', 0, CGlobalCounter::ALL_SITES, '', false);
		return $recordLimit;
	}

	$recordCount = CGlobalCounter::GetValue('vi_records', CGlobalCounter::ALL_SITES);
	if($recordCount < $recordLimit)
	{
		return $recordLimit - $recordCount;
	}

	if($recordMonth < $currentMonth)
	{
		Option::set("voximplant", "record_month", $currentMonth);
		CGlobalCounter::Set('vi_records', 0, CGlobalCounter::ALL_SITES, '', false);
		return $recordLimit;
	}
	return 0;
}