EntityCounterManager::prepareValue

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. EntityCounterManager
  4. prepareValue
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/counter/entitycountermanager.php
  • Класс: Bitrix\Crm\Counter\EntityCounterManager
  • Вызов: EntityCounterManager::prepareValue
static function prepareValue($code, $userID = 0)
{
	$counter = EntityCounterFactory::createNamed($code);
	if($counter !== null)
	{
		return $counter->getValue();
	}

	$parts = self::parseCode($code);
	if($parts['ENTITY_TYPE_ID'] !== \CCrmOwnerType::Undefined)
	{
		try
		{
			$counter = EntityCounterFactory::create(
				$parts['ENTITY_TYPE_ID'],
				$parts['TYPE_ID'],
				$userID > 0 ? $userID : \CCrmSecurityHelper::GetCurrentUserID(),
				$parts['EXTRAS']
			);
			return $counter->getValue();

		} catch (Main\ArgumentOutOfRangeException $e)
		{
			return 0;
		}
	}

	return 0;
}

Добавить комментарий