• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/helper/filter.php
  • Класс: BitrixTasksHelperFilter
  • Вызов: Filter::postProcessMainFilter
private function postProcessMainFilter(array $filter): array
{
	$prefix = '::SUBFILTER-';
	$searchKey = "{$prefix}COMMENT_SEARCH_INDEX";
	$statusKey = "{$prefix}STATUS";

	if (isset($filter["{$prefix}PARAMS"]['::REMOVE-MEMBER']))
	{
		unset($filter["{$prefix}ROLEID"]['MEMBER'], $filter["{$prefix}PARAMS"]['::REMOVE-MEMBER']);
	}

	if (isset($filter[$searchKey]))
	{
		reset($filter[$searchKey]);

		$key = key($filter[$searchKey]);
		$value = SearchIndex::prepareStringToSearch(current($filter[$searchKey]));
		if ($value !== '')
		{
			$filter[$searchKey]["*{$key}"] = $value;
		}
		unset($filter[$searchKey][$key]);
	}

	if (
		isset($filter[$statusKey]['REAL_STATUS'])
		&& !empty($filter[$statusKey]['REAL_STATUS'])
		&& !in_array(Status::COMPLETED, $filter[$statusKey]['REAL_STATUS'])
		&& (int)$this->getUserId() === User::getId()
	)
	{
		$filter[$statusKey] = [
			'::LOGIC' => 'OR',
			'::SUBFILTER-1' => $filter[$statusKey],
			'::SUBFILTER-2' => [
				'WITH_COMMENT_COUNTERS' => 'Y',
				'REAL_STATUS' => Status::COMPLETED,
			],
		];
	}

	return $filter;
}