• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/tools/correction.php
  • Класс: BitrixImOpenLinesToolsCorrection
  • Вызов: Correction::getCountChatSessionId
static function getCountChatSessionId(): int
{
	$status = Session::STATUS_CLOSE;
	$sql = "
		SELECT
			count(*) AS COUNT
		FROM
			b_imopenlines_session s
			INNER JOIN b_im_chat c
				ON s.CHAT_ID = c.ID
		WHERE
			s.CLOSED != 'Y'
			AND s.SPAM != 'Y'
			AND s.STATUS < {$status}
			AND SUBSTRING_INDEX(SUBSTRING_INDEX(c.ENTITY_DATA_1, '|', 6), '|', -1) = '0'
	";

	return (int) Application::getConnection()->queryScalar($sql);
}