• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/notification/task/throttle.php
  • Класс: BitrixTasksInternalsNotificationTaskThrottleTable
  • Вызов: ThrottleTable::submitUpdateMessage
static function submitUpdateMessage($taskId, $authorId, array $stateOrig, array $stateLast)
{
	if(!intval($authorId))
	{
		throw new BitrixTasksException('Incorrect author id');
	}

	$item = static::getByTaskId($taskId);
	if ($item['ID'] ?? null)
	{
		$last = unserialize($item['STATE_LAST'], ['allowed_classes' => false]);
		if(is_array($last) && is_array($stateLast))
		{
			$stateLast = array_merge($last, $stateLast);
		}

		$data = array(
			'STATE_LAST' => serialize($stateLast)
		);

		// if the next change was made by someone else, the origin author should know about that
		if($authorId != $item['AUTHOR_ID'])
		{
			$data['INFORM_AUTHOR'] = 1;
		}

		static::update($item['ID'], $data);
	}
	else
	{
		static::add(array(
			'TASK_ID' => $taskId,
			'AUTHOR_ID' => $authorId,
			'STATE_ORIG' => serialize($stateOrig),
			'STATE_LAST' => serialize($stateLast)
		));
	}
}