CCrmQuoteRestProxy::innerUpdate

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmQuoteRestProxy
  4. innerUpdate
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmQuoteRestProxy
  • Вызов: CCrmQuoteRestProxy::innerUpdate
protected function innerUpdate($ID, &$fields, &$errors, array $params = null)
{
	if(!CCrmQuote::CheckUpdatePermission($ID))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	if(!CCrmQuote::Exists($ID))
	{
		$errors[] = 'Quote is not found';
		return false;
	}

	$entity = self::getEntity();
	$compare = true;
	$options = array();
	if(!$this->isRequiredUserFieldCheckEnabled())
	{
		$options['DISABLE_REQUIRED_USER_FIELD_CHECK'] = true;
	}
	if(is_array($params))
	{
		if(isset($params['REGISTER_HISTORY_EVENT']))
		{
			$compare = mb_strtoupper($params['REGISTER_HISTORY_EVENT']) === 'Y';
		}
	}

	$defaultRequisiteLinkParams = Requisite\EntityLink::determineRequisiteLinkBeforeSave(
		CCrmOwnerType::Quote, $ID, Requisite\EntityLink::ENTITY_OPERATION_UPDATE, $fields
	);

	$result = $entity->Update($ID, $fields, $compare, true, $options);
	if($result !== true)
	{
		$errors[] = $entity->LAST_ERROR;
	}

	if ($result === true)
	{
		Requisite\EntityLink::register(
			CCrmOwnerType::Quote, (int)$ID,
			$defaultRequisiteLinkParams['REQUISITE_ID'],
			$defaultRequisiteLinkParams['BANK_DETAIL_ID'],
			$defaultRequisiteLinkParams['MC_REQUISITE_ID'],
			$defaultRequisiteLinkParams['MC_BANK_DETAIL_ID']
		);

		self::traceEntity(\CCrmOwnerType::Quote, $ID, $fields, true);
	}

	return $result;
}

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