- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/lib/sync/managers/datasyncmanager.php
- Класс: BitrixCalendarSyncManagersDataSyncManager
- Вызов: DataSyncManager::modifySingleEvent
private function modifySingleEvent(Connection $connection, array $event, array $additionalParams): ?int
{
$eventObject = $this->prepareEventParams(
$event,
$additionalParams['SECTION_ID'],
$connection->getOwner()->getId()
);
if ($eventObject->getId())
{
$result = $this->mapperFactory->getEvent()->update($eventObject, [
'userId' => $connection->getOwner()->getId(),
'bAffectToDav' => false, // Used to prevent synchro with calDav again
'bSilentAccessMeeting' => true,
'autoDetectSection' => false,
'originalFrom' => $connection->getVendor()->getCode(),
]);
}
else
{
$result = $this->mapperFactory->getEvent()->create($eventObject, [
'userId' => $connection->getOwner()->getId(),
'bAffectToDav' => false, // Used to prevent synchro with calDav again
'bSilentAccessMeeting' => true,
'autoDetectSection' => false,
'originalFrom' => $connection->getVendor()->getCode(),
]);
}
if ($result && $result->getId())
{
$data = [];
// Prepare Data with outer params
if (!empty($event['ATTENDEE']) || !empty($event['ORGANIZER_ENTITY']))
{
$this->parseInvitedAttendees($event, $data);
}
if (!empty($event['ATTACH']))
{
$this->parseAttachments($event, $data);
}
if (!empty($event['URL']))
{
$data['URL'] = $event['URL'];
}
if (!empty($additionalParams['EVENT_CONNECTION_ID']))
{
EventConnectionTable::update($additionalParams['EVENT_CONNECTION_ID'], [
'SYNC_STATUS' => Dictionary::SYNC_STATUS['success'],
'ENTITY_TAG' => $event['MODIFICATION_LABEL'] ?? null,
'VERSION' => (string)($additionalParams['VERSION'] ?? null),
'VENDOR_VERSION_ID' => (string)($additionalParams['VERSION'] ?? null),
'DATA' => $data,
]);
}
else
{
EventConnectionTable::add([
'EVENT_ID' => (int)$result->getId(),
'CONNECTION_ID' => $connection->getId(),
'VENDOR_EVENT_ID' => $event['XML_ID'] ?? null,
'SYNC_STATUS' => Dictionary::SYNC_STATUS['success'],
'ENTITY_TAG' => $event['MODIFICATION_LABEL'] ?? null,
'VERSION' => (string)($additionalParams['VERSION'] ?? null),
'VENDOR_VERSION_ID' => (string)($additionalParams['VERSION'] ?? null),
'DATA' => $data,
]);
}
return (int)$result->getId();
}
return null;
}