CCrmInvoiceRestService::getList

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmInvoiceRestService
  4. getList
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice_invoice.php
  • Класс: \CCrmInvoiceRestService
  • Вызов: CCrmInvoiceRestService::getList
static function getList($params, $nav = 0, CRestServer $server)
{
	if(!CCrmInvoice::CheckReadPermission(0))
		throw new RestException('Access denied.');

	self::$server = $server;

	$order = CCrmInvoiceRestUtil::getParamArray($params, 'order', array('ID' => 'DESC'));
	$filter = CCrmInvoiceRestUtil::getParamArray($params, 'filter');
	$select = CCrmInvoiceRestUtil::getParamArray($params, 'select');

	$filter = self::prepareFilter($filter);
	$select = self::prepareSelect($select);
	$order = self::prepareOrder($order);

	if (!is_array($select) || count($select) === 0)
		throw new RestException('Inadmissible fields for selection');

	$idInSelect = in_array('ID', $select, true);
	if (!$idInSelect)
		$select[] = 'ID';

	$dbResult = CCrmInvoice::GetList($order, $filter, false, self::getNavData($nav), $select);
	if (!is_object($dbResult))
	{
		$dbResult = new CDBResult();
		$dbResult->InitFromArray(array());
	}
	$dbResult->NavStart(IRestService::LIST_LIMIT, false);

	$result = array();
	while($arRow = $dbResult->NavNext(false))
	{
		$resultItem = self::filterFields($arRow, 'list');
		self::externalizeUserFields($resultItem);
		if (!$idInSelect && array_key_exists('ID', $resultItem))
			unset($resultItem['ID']);
		$result[] = $resultItem;
	}

	return self::setNavData($result, $dbResult);
}

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