- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/calendar/sharing.php
- Класс: Bitrix\Crm\Controller\Timeline\Calendar\Sharing
- Вызов: Sharing::sendLinkAction
public function sendLinkAction(
int $contactId,
int $contactTypeId,
int $ownerId,
int $ownerTypeId,
string $channelId,
string $senderId
): bool
{
if (!\Bitrix\Crm\Service\Container::getInstance()->getUserPermissions()->checkUpdatePermissions($ownerTypeId, $ownerId))
{
$this->addError(\Bitrix\Crm\Controller\ErrorCode::getAccessDeniedError());
return false;
}
$sendingResult = Helper::getInstance()->sendLinkToClient($ownerId, $contactId, $contactTypeId, $channelId, $senderId);
if ($sendingResult->getErrors())
{
$this->addErrors($sendingResult->getErrors());
return false;
}
$linkHash = $sendingResult->getData()['linkHash'];
$timelineResult = Helper::getInstance()->addTimelineEntry($linkHash, EventData::SHARING_ON_INVITATION_SENT);
if (!$timelineResult)
{
$this->addError(new Error('Timeline entry not created'));
return false;
}
return true;
}