CrmQuotes::search

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CrmQuotes
  4. search
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/main/uiselector/crmquotes.php
  • Класс: Bitrix\Crm\Integration\Main\UISelector\CrmQuotes
  • Вызов: CrmQuotes::search
public function search($params = [])
{
	$result = [
		'ITEMS' => [],
		'ADDITIONAL_INFO' => [],
	];

	$entityOptions = (!empty($params['options']) ? $params['options'] : []);
	$requestFields = (!empty($params['requestFields']) ? $params['requestFields'] : []);
	$search = $requestFields['searchString'];
	$prefix = static::getPrefix($entityOptions);

	if (
		$search <> ''
		&& (
			empty($entityOptions['enableSearch'])
			|| $entityOptions['enableSearch'] != 'N'
		)
	)
	{
		$filter = $this->getSearchFilter($search, $entityOptions);

		if ($filter === false)
		{
			return $result;
		}

		$res = CCrmQuote::getList(
			$this->getSearchOrder(),
			$filter,
			false,
			[ 'nTopCount' => 20 ],
			$this->getSearchSelect()
		);

		$resultItems = [];
		while ($quoteFields = $res->fetch())
		{
			$resultItems[$prefix . $quoteFields['ID']] = static::prepareEntity($quoteFields, $entityOptions);
		}

		$resultItems = $this->appendItemsByIds($resultItems, $search, $entityOptions);

		$resultItems = $this->processResultItems($resultItems, $entityOptions);

		$result["ITEMS"] = $resultItems;
	}

	return $result;
}

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