• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/lib/helper/mailbox.php
  • Класс: BitrixMailHelperMailbox
  • Вызов: Mailbox::incrementTree
public function incrementTree($message)
{
	if (empty($message['ID']))
	{
		throw new MainArgumentException("Argument 'message' is not valid");
	}

	if (!empty($message['IN_REPLY_TO']))
	{
		$item = MailMailMessageTable::getList(array(
			'select' => array(
				'ID', 'MSG_ID', 'LEFT_MARGIN', 'RIGHT_MARGIN',
			),
			'filter' => array(
				'=MAILBOX_ID' => $this->mailbox['ID'],
				'=MSG_ID' => $message['IN_REPLY_TO'],
			),
			'order' => array(
				'LEFT_MARGIN' => 'ASC',
			),
		))->fetch();

		if (!empty($item))
		{
			$message = $item;

			$item = MailMailMessageTable::getList(array(
				'select' => array(
					'ID', 'MSG_ID',
				),
				'filter' => array(
					'=MAILBOX_ID' => $this->mailbox['ID'],
					' $item['LEFT_MARGIN'],
					'>RIGHT_MARGIN' => $item['RIGHT_MARGIN'],
				),
				'order' => array(
					'LEFT_MARGIN' => 'ASC',
				),
				'limit' => 1,
			))->fetch();

			if (!empty($item))
			{
				$message = $item;
			}
		}
	}

	$this->resortTree($message);
}