EntityCounterSettings::createDefault

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. EntityCounterSettings
  4. createDefault
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/counter/entitycountersettings.php
  • Класс: Bitrix\Crm\Counter\EntityCounterSettings
  • Вызов: EntityCounterSettings::createDefault
static function createDefault(bool $isStagesSupported): self
{
	$isCountersEnabled = \Bitrix\Crm\Settings\CounterSettings::getInstance()->isEnabled();
	$isIdleCounterEnabled = \CCrmUserCounterSettings::GetValue(
		\CCrmUserCounterSettings::ReckonActivitylessItems,
		true
	);

	if (Crm::isUniversalActivityScenarioEnabled())
	{
		$enabledCounters = [
			\Bitrix\Crm\Counter\EntityCounterType::INCOMING_CHANNEL,
			\Bitrix\Crm\Counter\EntityCounterType::CURRENT,
			\Bitrix\Crm\Counter\EntityCounterType::ALL,
		];
		$enabledInFilterCounters = $enabledCounters;
		if ($isStagesSupported)
		{
			$enabledInFilterCounters[] = \Bitrix\Crm\Counter\EntityCounterType::IDLE;
		}
	}
	else
	{
		$enabledCounters = [];
		if ($isStagesSupported && $isIdleCounterEnabled)
		{
			$enabledCounters[] = \Bitrix\Crm\Counter\EntityCounterType::IDLE;
		}
		$enabledCounters[] = \Bitrix\Crm\Counter\EntityCounterType::PENDING;
		$enabledCounters[] = \Bitrix\Crm\Counter\EntityCounterType::OVERDUE;
		$enabledCounters[] = \Bitrix\Crm\Counter\EntityCounterType::CURRENT;
		$enabledCounters[] = \Bitrix\Crm\Counter\EntityCounterType::READY_TODO;
		$enabledCounters[] = \Bitrix\Crm\Counter\EntityCounterType::ALL;
		$enabledInFilterCounters = $enabledCounters;
	}

	return
		(new EntityCounterSettings())
			->setIsCountersEnabled($isCountersEnabled)
			->setEnabledCountersTypes($enabledCounters)
			->setEnabledInFilterCountersTypes($enabledInFilterCounters)
	;
}

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