does::getSubTreeSql

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. does
  4. getSubTreeSql
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/task/dependence.php
  • Класс: Bitrix\Tasks\Task\does
  • Вызов: does::getSubTreeSql
static function getSubTreeSql($id)
{
	$id = Assert::expectIntegerPositive($id, '$id');

	global $DB;

	$tableName = 		static::getTableName();

	$parentColName = 	static::getPARENTIDColumnName();
	$idColName = 		static::getIDColumnName();
	$directColName = 	static::getDIRECTColumnName();

	// select STATUS as REAL_STATUS, according to the CTasks::GetList() behaviour
	// (in \Bitrix\Tasks\TaskTable there is different alias naming)

	/*
	--DEP_T.DURATION_PLAN as DURATION_PLAN,
	*/

	// enough data to say if and how we can change dates
	// look also at \Bitrix\Tasks\Util\Scheduler::initializeTargetTask()

	// CDatabase::DateToCharFunction() converts database format like "2015-10-15 00:00:00"
	// to a site format: "22.06.2015 11:39:50", and optionally adds the timezone offset
	return "
		select 
			DEP.".$idColName." as ".$idColName.",
			DEP_P.TYPE as TYPE,
			DEP_P.".$parentColName." as FROM_TASK_ID,

			DEP_T.ID as ID,
			DEP_T.MATCH_WORK_TIME as MATCH_WORK_TIME,
			DEP_T.ALLOW_CHANGE_DEADLINE as ALLOW_CHANGE_DEADLINE,
			DEP_T.DURATION_TYPE as DURATION_TYPE,

			DEP_T.RESPONSIBLE_ID as RESPONSIBLE_ID,
			DEP_T.CREATED_BY as CREATED_BY,
			DEP_T.GROUP_ID as GROUP_ID,
			DEP_T.STATUS as REAL_STATUS,

			".$DB->DateToCharFunction("DEP_T.CREATED_DATE", "FULL")." as CREATED_DATE,
			".$DB->DateToCharFunction("DEP_T.START_DATE_PLAN", "FULL")." as START_DATE_PLAN,
			".$DB->DateToCharFunction("DEP_T.END_DATE_PLAN", "FULL")." as END_DATE_PLAN
		from 
			".$tableName." DEP

		inner join 
			b_tasks DEP_T
				on 
					DEP.".$idColName." = DEP_T.ID
		inner join 
			".$tableName." DEP_P 
				on 
					DEP_P.".$directColName." = '1'and DEP.".$idColName." = DEP_P.".$idColName."

		where DEP.".$parentColName." = '".intval($id)."'
	";
}

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