CCrmRestVat::filterFields

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRestVat
  4. filterFields
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice_invoice.php
  • Класс: \CCrmRestVat
  • Вызов: CCrmRestVat::filterFields
static function filterFields($fields, $method)
{
	$result = array();

	if (!is_array($fields) || count($fields) === 0)
		return $result;

	if (!in_array($method, array('get', 'add', 'update', 'list'), true))
		return $result;

	$fieldsInfo = self::getFieldsInfo();
	$allowedFields = array();
	foreach ($fieldsInfo as $fName => $fInfo)
	{
		if ($fInfo[$method] === true)
			$allowedFields[] = $fName;
	}
	unset($fName, $fInfo);

	foreach ($fields as $fName => $fValue)
	{
		if (in_array($fName, $allowedFields))
			$result[$fName] = CCrmInvoiceRestUtil::convertValue($method, $fieldsInfo[$fName]['type'], $fValue);
	}
	unset($fieldsInfo);

	return $result;
}

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