CCrmRestVat::delete

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRestVat
  4. delete
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice_invoice.php
  • Класс: \CCrmRestVat
  • Вызов: CCrmRestVat::delete
static function delete($params)
{
	if (!CModule::IncludeModule('catalog'))
		throw new RestException('The Commercial Catalog module is not installed.');

	global $DB, $USER;

	$CrmPerms = new CCrmPerms($USER->GetID());
	if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'))
		throw new RestException('Access denied.');

	$ID = CCrmInvoiceRestUtil::getParamScalar($params, 'id', 0);
	if($ID <= 0)
		throw new RestException('Invalid identifier.');

	$DB->StartTransaction();
	$catalogVat = new CCatalogVat();
	$bDeleted = $catalogVat->Delete($ID);
	if($bDeleted)
	{
		$DB->Commit();
	}
	else
	{
		$DB->Rollback();
		throw new RestException('Error on deleting VAT rate.');
	}

	return $bDeleted;
}

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