CCrmRequisitePresetFieldRestProxy::checkFields

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRequisitePresetFieldRestProxy
  4. checkFields
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmRequisitePresetFieldRestProxy
  • Вызов: CCrmRequisitePresetFieldRestProxy::checkFields
protected function checkFields($action, $presetId, $fields, &$errors)
{
	if (!isset($fields['FIELD_NAME']))
	{
		$errors = 'FIELD_NAME is not specified.';
		return false;
	}
	elseif($action === 'ADD')
	{
		$entity = self::getEntity();

		$fieldsAvailableToAdd = array();
		$result = $entity->getSettingsFieldsAvailableToAdd(EntityPreset::Requisite, $presetId);
		if ($result->isSuccess())
		{
			$fieldsAvailableToAdd = $result->getData();
			if (!is_array($fieldsAvailableToAdd))
				$fieldsAvailableToAdd = array();
		}

		if (!in_array($fields['FIELD_NAME'], $fieldsAvailableToAdd, true))
		{
			$errors = 'The field '.
					(isset($fields['FIELD_NAME']) ? "'".$fields['FIELD_NAME']."' " : "").
					'can not be added.';
			return false;
		}
	}
	return true;
}

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