Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
crmsharing.php
1<?php
2
4
9
11{
12 protected int $userId;
13 protected int $entityId;
14
19 public function __construct(int $userId, int $entityId)
20 {
21 $this->userId = $userId;
22 $this->entityId = $entityId;
23 }
24
33 public function generateCrmDealJointLink(
34 array $memberIds,
35 ?int $contactId = null,
36 ?int $contactType = null,
37 ?string $channelId = null,
38 ?string $senderId = null,
39 ): Result
40 {
41 $result = new Result();
42
43 if (
44 (!is_null($contactId) && $contactId <= 0)
45 || (!is_null($contactType) && $contactType <= 0)
46 )
47 {
48 $result->addError(new Error('Invalid data was provided', 100070));
49 }
50
51 if ($result->isSuccess())
52 {
53 $crmDealLink = (new CrmDealLink())
54 ->setOwnerId($this->userId)
55 ->setEntityId($this->entityId)
56 ->setContactType($contactType)
57 ->setContactId($contactId)
58 ->setChannelId($channelId)
59 ->setSenderId($senderId)
60 ;
61 $crmDealJointLink = Factory::getInstance()->createCrmDealJointLink($crmDealLink, $memberIds);
62 $result->setData(['link' => $crmDealJointLink]);
63 }
64
65 return $result;
66 }
67}
generateCrmDealJointLink(array $memberIds, ?int $contactId=null, ?int $contactType=null, ?string $channelId=null, ?string $senderId=null,)
__construct(int $userId, int $entityId)