CCrmInvoiceRecurringRestProxy::innerUpdate

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmInvoiceRecurringRestProxy
  4. innerUpdate
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmInvoiceRecurringRestProxy
  • Вызов: CCrmInvoiceRecurringRestProxy::innerUpdate
protected function innerUpdate($ID, &$fields, &$errors, array $params = null)
{
	$result = $this->innerGet($ID, $errors);
	if (!$result)
	{
		return false;
	}
	elseif(!CCrmInvoice::CheckUpdatePermission($result['INVOICE_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
	{
		$invoiceRecurring = \Bitrix\Crm\Recurring\Entity\Invoice::getInstance();
		$invoiceRecurring->update($ID, $fields);
		return true;
	}
	catch(Main\SystemException $ex)
	{
		$errors[] = $ex->getMessage();
		return false;
	}
}

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