Task::syncBadges

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Task
  4. syncBadges
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/tasks/task.php
  • Класс: Bitrix\Crm\Activity\Provider\Tasks\Task
  • Вызов: Task::syncBadges
static function syncBadges(int $activityId, array $activityFields, array $bindings): void
{
	$taskStatus = new TaskActivityStatus();
	$status = $activityFields['SETTINGS']['ACTIVITY_STATUS'] ?? null;
	if (!$status || !$taskStatus->isStatusValid($status))
	{
		return;
	}

	$badge = Container::getInstance()->getBadge(
		Badge\Type\TaskStatus::TASK_STATUS_TYPE,
		$status,
	);

	$sourceIdentifier = new Badge\SourceIdentifier(
		Badge\SourceIdentifier::CRM_OWNER_TYPE_PROVIDER,
		CCrmOwnerType::Activity,
		$activityId,
	);

	foreach ($bindings as $singleBinding)
	{
		$itemIdentifier = new ItemIdentifier((int)$singleBinding['OWNER_TYPE_ID'], (int)$singleBinding['OWNER_ID']);
		$badge->unbindWithAnyValue($itemIdentifier, $sourceIdentifier);
		$badge->upsert($itemIdentifier, $sourceIdentifier);
	}
}

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