Task::sendUpdatePush

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. sendUpdatePush
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/task.php
  • Класс: BitrixTasksControlTask
  • Вызов: Task::sendUpdatePush
private function sendUpdatePush($updateComment)
{
	if ($this->skipPush)
	{
		return;
	}
	$taskData = $this->getFullTaskData();
	if (!$taskData)
	{
		return;
	}

	$newParticipants = $this->getParticipants($taskData);
	$oldParticipants = $this->getParticipants($this->sourceTaskData);
	$participants = array_unique(array_merge($newParticipants, $oldParticipants));
	$removedParticipants = array_unique(array_diff($oldParticipants, $newParticipants));


	$before = [];
	$after = [];

	foreach ($this->changes as $field => $value)
	{
		$before[$field] = $value['FROM_VALUE'];
		$after[$field] = $value['TO_VALUE'];
	}

	$before['GROUP_ID'] = (int) $this->sourceTaskData['GROUP_ID'];
	$after['GROUP_ID'] = (int) $taskData['GROUP_ID'];

	$lastResult = ResultManager::getLastResult($this->taskId);

	$params = [
		'TASK_ID' => $this->taskId,
		'USER_ID' => $this->userId,
		'BEFORE' => $before,
		'AFTER' => $after,
		'TS' => time(),
		'event_GUID' => $this->eventGuid,
		'params' => [
			'HIDE' => (array_key_exists('HIDE', $this->byPassParams) ? (bool)$this->byPassParams['HIDE'] : true),
			'updateCommentExists' => $updateComment,
			'removedParticipants' => array_values($removedParticipants),
		],
		'taskRequireResult' => ResultManager::requireResult($this->taskId) ? "Y" : "N",
		'taskHasResult' => $lastResult ? "Y" : "N",
		'taskHasOpenResult' => ($lastResult && (int) $lastResult['STATUS'] === ResultTable::STATUS_OPENED) ? "Y" : "N",
	];

	try
	{
		PushService::addEvent($participants, [
			'module_id' => 'tasks',
			'command' => PushCommand::TASK_UPDATED,
			'params' => $params,
		]);
	}
	catch (Exception $e)
	{
		return false;
	}

	return true;
}

Добавить комментарий