CalendarSharing::syncBadges

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CalendarSharing
  4. syncBadges
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/calendarsharing.php
  • Класс: Bitrix\Crm\Activity\Provider\CalendarSharing
  • Вызов: CalendarSharing::syncBadges
static function syncBadges(int $activityId, array $activityFields, array $bindings): void
{
	if (!isset($activityFields['SETTINGS']['LINK_ID']) || !(int)$activityFields['SETTINGS']['LINK_ID'])
	{
		return;
	}

	$isCompleted = isset($activityFields['COMPLETED']) && $activityFields['COMPLETED'] === 'Y';
	if (!$isCompleted)
	{
		return;
	}

	$badge = Container::getInstance()->getBadge(
		CalendarSharingStatus::CALENDAR_SHARING_STATUS_TYPE,
		CalendarSharingStatus::CANCELED_BY_CLIENT
	);

	$itemIdentifier = new ItemIdentifier(
		(int)$activityFields['OWNER_TYPE_ID'],
		(int)$activityFields['OWNER_ID']
	);

	$sourceIdentifier = new SourceIdentifier(
		SourceIdentifier::CALENDAR_SHARING_TYPE_PROVIDER,
		0,
		$activityFields['SETTINGS']['LINK_ID']
	);

	if (isset($activityFields['SETTINGS']['CANCELED_BY_CLIENT']))
	{
		$badge->upsert($itemIdentifier, $sourceIdentifier);
	}
	else
	{
		$badge->unbindWithAnyValue($itemIdentifier, $sourceIdentifier);
	}
}

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