Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/calendar/lib/sharing/crm/ |
Upload File : |
<?php namespace Bitrix\Calendar\Sharing\Crm; use Bitrix\Calendar\Sharing\Link\CrmDealLink; use Bitrix\Calendar\Sharing\Link\Factory; use Bitrix\Main\Error; use Bitrix\Main\Result; class CrmSharing { protected int $userId; protected int $entityId; /** * @param int $userId * @param int $entityId */ public function __construct(int $userId, int $entityId) { $this->userId = $userId; $this->entityId = $entityId; } /** * @param array $memberIds * @param int|null $contactId * @param int|null $contactType * @param string|null $channelId * @param string|null $senderId * @return Result */ public function generateCrmDealJointLink( array $memberIds, ?int $contactId = null, ?int $contactType = null, ?string $channelId = null, ?string $senderId = null, ): Result { $result = new Result(); if ( (!is_null($contactId) && $contactId <= 0) || (!is_null($contactType) && $contactType <= 0) ) { $result->addError(new Error('Invalid data was provided', 100070)); } if ($result->isSuccess()) { $crmDealLink = (new CrmDealLink()) ->setOwnerId($this->userId) ->setEntityId($this->entityId) ->setContactType($contactType) ->setContactId($contactId) ->setChannelId($channelId) ->setSenderId($senderId) ; $crmDealJointLink = Factory::getInstance()->createCrmDealJointLink($crmDealLink, $memberIds); $result->setData(['link' => $crmDealJointLink]); } return $result; } }