CCrmDealRecurringRestProxy::innerUpdate

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

	if (
		!empty($fields['PARAMS']) && is_array($fields['PARAMS'])
		|| !empty($fields['START_DATE'])
		|| !empty($fields['LIMIT_DATE'])
		|| !empty($fields['IS_LIMIT'])
	)
	{
		$merged = array_merge($result, $fields);
		$fields['PARAMS'] = $this->prepareParams($merged);
	}

	if(!empty($fields['START_DATE']))
	{
		$fields['START_DATE'] = new \Bitrix\Main\Type\Date($fields['START_DATE']);
	}
	if(!empty($fields['LIMIT_DATE']))
	{
		$fields['LIMIT_DATE'] = new \Bitrix\Main\Type\Date($fields['LIMIT_DATE']);
	}

	try
	{
		$dealRecurring = \Bitrix\Crm\Recurring\Entity\Deal::getInstance();
		$r = $dealRecurring->update($ID, $fields);
		if (!$r->isSuccess())
		{
			$errors = $r->getErrorMessages();
			return false;
		}
		return true;
	}
	catch(Main\SystemException $ex)
	{
		$errors[] = $ex->getMessage();
		return false;
	}
}

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