• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/counter/user.php
  • Класс: BitrixTasksInternalsCounterUser
  • Вызов: User::calcMyExpiredSoon
private function calcMyExpiredSoon($reCache = false)
{
	static $count = null;

	if ($count == null || $reCache)
	{
		$expiredSoonTime = $this->getExpiredSoonTime();
		$expiredTime = $this->getExpiredTime();
		$statusSupposedlyCompleted = CTasks::STATE_SUPPOSEDLY_COMPLETED;
		$statusCompleted = CTasks::STATE_COMPLETED;
		$statusDeferred = CTasks::STATE_DEFERRED;

		$sql = "
			SELECT 
				COUNT(ID) as COUNT,
				GROUP_ID
			FROM 
				b_tasks 
			WHERE 
				DEADLINE < '{$expiredSoonTime}'
				AND DEADLINE >= '{$expiredTime}'
				AND RESPONSIBLE_ID = {$this->userId}
				AND RESPONSIBLE_ID != CREATED_BY
				AND ZOMBIE = 'N'
				".($this->groupId > 0 ? " AND GROUP_ID = {$this->groupId}" : "")."
				AND (
					STATUS != {$statusSupposedlyCompleted}
					AND STATUS != {$statusCompleted}
					AND	STATUS != {$statusDeferred}
				)
			GROUP BY 
				GROUP_ID
		";

		$this->changeCounter(
			CounterName::MY_EXPIRED_SOON,
			Application::getConnection()->query($sql)->fetchAll()
		);
	}
}