GridFilter::handleNumberFilterRow

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. GridFilter
  4. handleNumberFilterRow
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/project/filter/gridfilter.php
  • Класс: BitrixTasksInternalsProjectFilterGridFilter
  • Вызов: GridFilter::handleNumberFilterRow
private function handleNumberFilterRow($id, $filterData, Query $query): Query
{
	$from = "{$id}_from";
	$to = "{$id}_to";
	$less = "<={$id}";
	$more = ">={$id}";

	$filter = [];

	if (array_key_exists($from, $filterData) && !empty($filterData[$from]))
	{
		$filter[$more] = Query::filter()->where($id, '>=', $filterData[$from]);
	}
	if (array_key_exists($to, $filterData) && !empty($filterData[$to]))
	{
		$filter[$less] = Query::filter()->where($id, '<=', $filterData[$to]);
	}

	if (
		array_key_exists($more, $filter)
		&& array_key_exists($less, $filter)
		&& $filter[$more] === $filter[$less]
	)
	{
		$filter[$id] = $filter[$more];
		unset($filter[$more], $filter[$less]);
	}

	foreach ($filter as $condition)
	{
		$query->where($condition);
	}

	return $query;
}

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