CCrmMeasureRestProxy::innerUpdate

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmMeasureRestProxy
  4. innerUpdate
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmMeasureRestProxy
  • Вызов: CCrmMeasureRestProxy::innerUpdate
protected function innerUpdate($ID, &$fields, &$errors, array $params = null)
{
	/** @global CMain $APPLICATION */
	global $APPLICATION;

	if (!CModule::IncludeModule('catalog'))
	{
		$errors[] = 'The Commercial Catalog module is not installed.';
		return false;
	}

	$userPermissions = CCrmAuthorizationHelper::GetUserPermissions();
	if (!CCrmAuthorizationHelper::CheckConfigurationUpdatePermission($userPermissions))
	{
		$errors[] = 'Access denied.';
		return false;
	}
	unset($userPermissions);

	$res = CCatalogMeasure::getList(array(), array('=ID' => $ID), false, false, array('ID'));
	$result = $res ? $res->Fetch() : null;
	if(!is_array($result))
	{
		$errors[] = 'Not found';
		return false;
	}
	unset($res);

	$result = CCatalogMeasure::update($ID, $fields);
	if($result !== $ID)
	{
		if($exception = $APPLICATION->GetException())
			$errors[] = $exception->GetString();
		else
			$errors[] = 'Unknown error when updating unit of measurement.';
		return false;
	}

	return true;
}

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