Task::getAccessibleSubEmployeesTasksQuery

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. getAccessibleSubEmployeesTasksQuery
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/runtime/task.php
  • Класс: BitrixTasksInternalsRunTimeTask
  • Вызов: Task::getAccessibleSubEmployeesTasksQuery
static function getAccessibleSubEmployeesTasksQuery($parameters, $filter, $runtimeOptions)
{
	if (static::isDirector($parameters))
	{
		$memberReferenceFilter = ['=ref.TASK_ID' => 'this.ID'];

		if ($parameters['APPLY_MEMBER_FILTER'] ?? null)
		{
			$memberCondition = static::getMemberConditions($parameters['APPLY_MEMBER_FILTER'], $parameters);
			$memberReferenceFilter = array_merge($memberReferenceFilter, $memberCondition[0]);
		}

		$memberReference = new EntityReferenceField(
			'TM',
			MemberTable::getEntity(),
			[$memberReferenceFilter],
			['join_type' => 'inner']
		);

		$subordinate = IntranetInternalsRuntimeUserDepartment::getSubordinateFilter(array(
			'USER_ID' => $parameters['USER_ID'],
			'REF_FIELD' => 'TM.USER_ID',
		));

		$query = new EntityQuery(TaskTable::getEntity());
		$query->setSelect(['TASK_ID' => 'ID']);
		$query->registerRuntimeField('', $memberReference);
		self::apply($query, [$subordinate]);

		$query = static::setRuntimeOptionsForQuery($runtimeOptions, $query);

		if (!empty($filter))
		{
			$query->setFilter($filter);
		}

		return $query->getQuery();
	}

	return '';
}

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