CCrmInvoiceRecurringRestProxy::innerDelete

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmInvoiceRecurringRestProxy
  4. innerDelete
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmInvoiceRecurringRestProxy
  • Вызов: CCrmInvoiceRecurringRestProxy::innerDelete
protected function innerDelete($ID, &$errors, array $params = null)
{
	$invoiceRecurring = \Bitrix\Crm\Recurring\Entity\Invoice::getInstance();
	if (!$invoiceRecurring->isAllowedExpose())
	{
		$errors[] = 'Recurring is not allowed';
		return false;
	}

	$recurringDataRaw = $invoiceRecurring->getList([
		'filter' => ['ID' => (int)$ID],
		'limit' => 1
	]);

	if (!($recurringDataRaw->fetch()))
	{
		$errors[] = 'Recurring invoice is not found';
		return false;
	}

	elseif(!CCrmInvoice::CheckDeletePermission(0, CCrmPerms::GetCurrentUserPermissions()))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	try
	{
		$r = $invoiceRecurring->delete($ID);
		if (!$r->isSuccess())
		{
			$errors = $r->getErrorMessages();
			return false;
		}
		return true;
	}
	catch(Main\SystemException $ex)
	{
		$errors[] = $ex->getMessage();
		return false;
	}
}

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