MonitorByActResponsible::resetForCategoryChanged

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. MonitorByActResponsible
  4. resetForCategoryChanged
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/counter/monitor/monitorbyactresponsible.php
  • Класс: Bitrix\Crm\Counter\Monitor\MonitorByActResponsible
  • Вызов: MonitorByActResponsible::resetForCategoryChanged
private function resetForCategoryChanged()
{
	$changedEntities = $this->entitiesChangesCollection->onlyCategoryChangedEntities();

	if ($changedEntities->isEmpty())
	{
		return;
	}

	$identifiers = array_map(fn(EntityChange $item) => $item->getIdentifier(), $changedEntities->getValues());
	$responsible = $this->loadActivityResponsibleIds($identifiers);

	/** @var $changedEntity EntityChange */
	foreach ($changedEntities as $changedEntity)
	{
		$entityTypeId = $changedEntity->getIdentifier()->getEntityTypeId();
		$iiHash = $changedEntity->getIdentifier()->getHash();

		if (!isset($responsible[$iiHash]))
		{
			return;
		}

		foreach ($responsible[$iiHash] as $responsibleId)
		{
			$this->resetCounters(
				$entityTypeId,
				EntityCounterType::getAll(true),
				$responsibleId,
				$changedEntity->getOldCategoryId(),
			);

			$this->resetCounters(
				$entityTypeId,
				EntityCounterType::getAll(true),
				$responsibleId,
				$changedEntity->getActualCategoryId(),
			);
		}
	}
}

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