CCrmRequisitePresetRestProxy::innerDelete

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRequisitePresetRestProxy
  4. innerDelete
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmRequisitePresetRestProxy
  • Вызов: CCrmRequisitePresetRestProxy::innerDelete
protected function innerDelete($ID, &$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::checkDeletePermissionOwnerEntity($entityTypeID))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	$entity = self::getEntity();

	$result = $entity->delete($ID);

	if (is_object($result))
	{
		if($result->isSuccess())
		{
			$result = true;
		}
		else
		{
			$errors = $result->getErrors();
			$result = false;
		}
	}
	else
	{
		$errors[] = 'Error when deleting preset.';
		$result = false;
	}

	return $result;
}

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