CCrmStatusInvoiceRestProxy::innerDelete

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

	if(!CCrmStatus::CheckDeletePermission($ID))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	$statusInvoice = new CCrmStatusInvoice('INVOICE_STATUS');
	$currentFields = $statusInvoice->getStatusById($ID);
	if(!is_array($currentFields))
	{
		$errors[] = 'Status is not found.';
		return false;
	}

	if (isset($currentFields['SYSTEM']) && $currentFields['SYSTEM'] === 'Y')
	{
		$errors[] = "Can't delete system status";
		return false;
	}

	$result = $statusInvoice->Delete($ID);
	if($result === false)
	{
		if ($e = $APPLICATION->GetException())
			$errors[] = $e->GetString();
		else
			$errors[] = 'Error on deleting status.';
	}
	return $result !== false;
}

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