• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_sect.php
  • Класс: CCalendarSect
  • Вызов: CCalendarSect::onUpdateSync
static function onUpdateSync(int $id, array $params)
{
	if (!Loader::includeModule('dav'))
	{
		return null;
	}

	if (($params['params']['arFields']['CAL_TYPE'] ?? null) !== 'user')
	{
		return null;
	}

	if (empty($params['params']['arFields']['NAME']))
	{
		return new Result();
	}

	/** @var BitrixCalendarCoreSectionSection $section */
	$section = (new BitrixCalendarCoreMappersSection())->getById($id);
	if (!$section)
	{
		return null;
	}

	$factories = FactoriesCollection::createBySection($section);
	if ($factories->count() === 0)
	{
		return null;
	}
	$syncManager = new Synchronization($factories);
	$context = new Context([]);
	if (!empty($params['params']['originalFrom']))
	{
		$context->add('sync', 'originalFrom', $params['params']['originalFrom']);
	}

	return $syncManager->updateSection($section, $context);
}