- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/integration/intranet/internals/runtime/userdepartment.php
- Класс: BitrixTasksIntegrationIntranetInternalsRuntimeUserDepartment
- Вызов: UserDepartment::getSubordinateFilter
static function getSubordinateFilter(array $parameters = array())
{
if(!static::includeModule())
{
return array();
}
if (!($iblockId = self::getStructureIblockId()))
{
return array();
}
if (!($ufId = self::getDepartmentUfId()))
{
return array();
}
return array(
'runtime' => array(
new FieldsRelationsReference(
'IBS_UFV',
UtsIblockSectionTable::getEntity(),
Query::filter()->where('ref.UF_HEAD', '=', $parameters['USER_ID']),
array('join_type' => 'inner')
),
new FieldsRelationsReference(
'IBS',
BitrixIblockSectionTable::getEntity(),
Query::filter()->where('ref.ID', '=', new ColumnExpression('this.IBS_UFV.VALUE_ID')),
array('join_type' => 'inner')
),
new FieldsRelationsReference(
'DEP',
BitrixIblockSectionTable::getEntity(),
Query::filter()
->where('ref.IBLOCK_ID', '=', $iblockId)
->where('ref.LEFT_MARGIN', '>=', new ColumnExpression('this.IBS.LEFT_MARGIN'))
->where('ref.RIGHT_MARGIN', '<=', new ColumnExpression('this.IBS.RIGHT_MARGIN')),
array('join_type' => 'inner')
),
new FieldsRelationsReference(
'U_UFV',
UtmUserTable::getEntity(),
Query::filter()
->where('ref.FIELD_ID', '=', $ufId)
->where('ref.VALUE_INT', '>', 0)
->where('ref.VALUE_INT', '=', new ColumnExpression('this.DEP.ID'))
->where('ref.VALUE_ID', '=', new ColumnExpression("this.{$parameters['REF_FIELD']}")),
array('join_type' => 'inner')
),
),
);
}