36 $userId = $this->getContext()->getUserId();
39 $taskLink->setEntity($taskItem)->setChatId($chatId)->setAuthorId($userId);
43 $taskLink->setMessageId($messageId);
48 if (!$sendMessageResult->isSuccess())
50 $result->addErrors($sendMessageResult->getErrors());
53 $systemMessageId = $sendMessageResult->getResult();
55 $taskLink->setMessageId($messageId ?: $systemMessageId);
56 $saveResult = $taskLink->save();
58 if (!$saveResult->isSuccess())
60 return $result->addErrors($saveResult->getErrors());
64 ->setContext($this->context)
65 ->sendFull($taskLink, self::ADD_TASK_EVENT, [
'RECIPIENT' => $taskItem->getMembersIds()])
117 $saveResult = $taskItem->
save();
119 if (!$saveResult->isSuccess())
121 return $result->addErrors($saveResult->getErrors());
125 ->setContext($this->context)
126 ->sendFull($taskItem, self::UPDATE_TASK_EVENT, [
'RECIPIENT' => $taskItem->
getEntity()->getMembersIds()])
143 if (!Loader::includeModule(
'tasks'))
148 $userId = $this->getContext()->getUserId();
150 $chat->setContext($this->context);
152 $data = [
'PARAMS' => []];
154 $taskPath = (
new TaskPathMaker(0, PathMaker::EDIT_ACTION, $userId))->makeEntityPath();
155 $link =
new Uri($taskPath);
158 'ta_el' =>
'create_button',
161 $data[
'LINK'] = $link->getUri();
163 $data[
'PARAMS'][
'RESPONSIBLE_ID'] = $userId;
164 $data[
'PARAMS'][
'IM_CHAT_ID'] = $chat->getChatId();
166 if ($chat->getEntityType() !==
'SONET_GROUP')
168 $data[
'PARAMS'][
'AUDITORS'] = implode(
",", $this->
getAuditors($chat));
171 if ($chat->getEntityType() ===
'SONET_GROUP')
173 $data[
'PARAMS'][
'GROUP_ID'] = (int)$chat->getEntityId();
178 $entityData = explode(
'|', $chat->getEntityData1() ??
'');
179 if (isset($entityData[0], $entityData[1], $entityData[2]) && $entityData[0] ===
'Y')
181 $crmType = \CCrmOwnerTypeAbbr::ResolveByTypeID(\CCrmOwnerType::ResolveID($entityData[1]));
182 $data[
'PARAMS'][
'UF_CRM_TASK'] = $crmType.
'_'.$entityData[2];
188 $message->setContext($this->context);
189 $data[
'PARAMS'][
'DESCRIPTION'] = \CIMShare::PrepareText([
190 'CHAT_ID' => $chat->getChatId(),
191 'MESSAGE_ID' => $message->getMessageId(),
192 'MESSAGE_TYPE' => $chat->
getType(),
193 'MESSAGE' => $message->getMessage(),
194 'AUTHOR_ID' => $message->getAuthorId(),
195 'FILES' => $this->getFilesForPrepareText($message)
200 if (!empty($fileIds))
202 $diskFileUFCode = \Bitrix\Tasks\Integration\Disk\UserField::getMainSysUFCode();
203 $data[
'PARAMS'][$diskFileUFCode] = $fileIds;
205 $data[
'PARAMS'][$diskFileUFCode .
'_SIGN'] = $signer->sign(Json::encode($fileIds), static::SIGNATURE_SALT);
208 $data[
'PARAMS'][
'IM_MESSAGE_ID'] = $message->getMessageId();
211 return $result->setResult($data);
290 $genderModifier = ($this->getContext()->getUser()->getGender() ===
'F') ?
'_F' :
'';
296 'IM_CHAT_TASK_REGISTER_FROM_MESSAGE_NOTIFICATION' . $genderModifier,
298 '#LINK#' => $task->
getEntity()->getUrl(),
299 '#USER_ID#' => $this->getContext()->getUserId(),
308 'IM_CHAT_TASK_REGISTER_FROM_CHAT_NOTIFICATION' . $genderModifier .
'_MSGVER_1',
310 '#LINK#' => $task->
getEntity()->getUrl(),
311 '#USER_ID#' => $this->getContext()->getUserId(),
312 '#TASK_TITLE#' => $task->
getEntity()->getTitle(),