• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Operation/Add.php
  • Класс: Bitrix\Crm\Service\Operation\Add
  • Вызов: Add::saveToHistory
protected function saveToHistory(): Result
{
	$registrar = Container::getInstance()->getRelationRegistrar();

	$registrar->registerByFieldsChange(
		$this->getItemIdentifier(),
		$this->fieldsCollection->toArray(),
		[],
		$this->item->getData(),
		$this->getItemsThatExcludedFromTimelineRelationEventsRegistration(),
		$this->getContext(),
	);

	if ($this->item->hasField(Item::FIELD_NAME_CONTACT_BINDINGS))
	{
		$registrar->registerByBindingsChange(
			$this->getItemIdentifier(),
			\CCrmOwnerType::Contact,
			[],
			$this->item->getContactBindings(),
			$this->getItemsThatExcludedFromTimelineRelationEventsRegistration(),
			$this->getContext(),
		);
	}

	if ($this->item->hasField(Item\Contact::FIELD_NAME_COMPANY_BINDINGS))
	{
		$registrar->registerByBindingsChange(
			$this->getItemIdentifier(),
			\CCrmOwnerType::Company,
			[],
			$this->item->get(Item\Contact::FIELD_NAME_COMPANY_BINDINGS),
			$this->getItemsThatExcludedFromTimelineRelationEventsRegistration(),
			$this->getContext(),
		);
	}

	return new Result();
}