• Модуль: crmmobile
  • Путь к файлу: ~/bitrix/modules/crmmobile/lib/Controller/EntityDetails.php
  • Класс: BitrixCrmMobileControllerEntityDetails
  • Вызов: EntityDetails::getTodoNotificationParams
protected function getTodoNotificationParams(Factory $factory, Item $entity, array $permissions = null): ?array
{
	if (!is_array($permissions))
	{
		$permissions = $this->getEntityPermissions($entity);
	}

	if (
		empty($permissions['update'])
		|| !in_array($factory->getEntityName(), self::ALLOWED_ENTITY_TYPES_WITH_TODO_NOTIFICATION, true)
	)
	{
		return null;
	}

	if (!$factory->isStagesEnabled())
	{
		return null;
	}

	$counter = new EntityActivityCounter($entity->getEntityTypeId(), [$entity->getId()]);

	return [
		'notificationSupported' => $factory->isSmartActivityNotificationSupported(),
		'notificationEnabled' => $factory->isSmartActivityNotificationEnabled(),
		'plannedActivityCounter' => $counter->getCounters()[$entity->getId()]['N'] ?? 0,
		'user' => CCrmViewHelper::getUserInfo(),
		'isFinalStage' => (
			$factory->isStagesSupported()
			&& $factory->getStageSemantics($entity->getStageId()) !== PhaseSemantics::PROCESS
		),
	];
}