CCrmRequisitePresetRestProxy::innerUpdate

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRequisitePresetRestProxy
  4. innerUpdate
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmRequisitePresetRestProxy
  • Вызов: CCrmRequisitePresetRestProxy::innerUpdate
protected function innerUpdate($ID, &$fields, &$errors, array $params = null)
{
	$r = $this->getById($ID);
	if(!is_array($r))
	{
		$errors[] = "The Preset with ID '{$ID}' is not found";
		return false;
	}

	$entityTypeID = intval($r['ENTITY_TYPE_ID']);

	if(!$this->isValidID($entityTypeID) || $entityTypeID !== EntityPreset::Requisite)
	{
		$errors[] = "ENTITY_TYPE_ID is not defined or invalid.";
		return false;
	}

	if(!EntityPreset::checkUpdatePermissionOwnerEntity($entityTypeID))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	$entity = self::getEntity();
	$result = $entity->update($ID, $fields);

	if($result->isSuccess())
	{
		return true;
	}
	else
	{
		$errors = $result->getErrors();
		return false;
	}

	$errors[] = 'Error when updating preset.';
	return false;
}

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