- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/timeline/entitycontroller.php
- Класс: Bitrix\Crm\Timeline\EntityController
- Вызов: EntityController::onConvertImplementation
protected function onConvertImplementation($ownerID, array $params): void
{
$ownerID = (int)$ownerID;
if ($ownerID <= 0)
{
throw new ArgumentException('Owner ID must be greater than zero.', 'ownerID');
}
$entities = isset($params['ENTITIES']) && is_array($params['ENTITIES']) ? $params['ENTITIES'] : [];
if (empty($entities))
{
return;
}
$settings = ['ENTITIES' => []];
foreach ($entities as $entityTypeName => $entityID)
{
$entityTypeID = \CCrmOwnerType::ResolveID($entityTypeName);
if ($entityTypeID === \CCrmOwnerType::Undefined)
{
continue;
}
$settings['ENTITIES'][] = ['ENTITY_TYPE_ID' => $entityTypeID, 'ENTITY_ID' => $entityID];
}
$authorID = \CCrmSecurityHelper::GetCurrentUserID();
if ($authorID <= 0)
{
$authorID = static::getDefaultAuthorId();
}
$historyEntryID = ConversionEntry::create(
[
'ENTITY_TYPE_ID' => $this->getEntityTypeID(),
'ENTITY_ID' => $ownerID,
'AUTHOR_ID' => $authorID,
'SETTINGS' => $settings,
]
);
$this->sendPullEventOnAdd(
new \Bitrix\Crm\ItemIdentifier($this->getEntityTypeID(), $ownerID),
$historyEntryID
);
}