public static function SaveCommunications($ID, $arComms, $arFields = array(), $registerEvents = true, $checkPerms = true) { if (empty($arFields)) { $arFields = self::GetByID($ID, false); } $ownerID = isset($arFields['OWNER_ID']) ? $arFields['OWNER_ID'] : 0; $ownerTypeID = isset($arFields['OWNER_TYPE_ID']) ? $arFields['OWNER_TYPE_ID'] : 0; foreach ($arComms as &$arComm) { self::PrepareCommunicationSettings($arComm); $arComm['ENTITY_SETTINGS'] = serialize($arComm['ENTITY_SETTINGS']); $arComm['ACTIVITY_ID'] = $ID; $arComm['OWNER_ID'] = $ownerID; $arComm['OWNER_TYPE_ID'] = $ownerTypeID; } unset($arComm); CCrmActivity::DoSaveCommunications($ID, $arComms, $arFields, $registerEvents, $checkPerms); }