Document::unconfirmAction

  1. Bitrix24 API (v. 23.675.0)
  2. catalog
  3. Document
  4. unconfirmAction
  • Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/controller/document.php
  • Класс: BitrixCatalogControllerDocument
  • Вызов: Document::unconfirmAction
public function unconfirmAction(int $id): ?bool
{
	if (!Feature::isInventoryManagementEnabled())
	{
		$this->addError(new Error(Loc::getMessage('DOCUMENT_CONTROLLER_NO_INVENTORY_MANAGEMENT_ENABLED_ERROR')));

		return null;
	}

	if (!$this->checkDocumentAccess(ActionDictionary::ACTION_STORE_DOCUMENT_CONDUCT, $id))
	{
		return null;
	}

	$userId = CurrentUser::get()->getId();
	if (!CCatalogDocs::cancellationDocument($id, $userId))
	{
		$error = '';

		global $APPLICATION;
		if ($APPLICATION->GetException())
		{
			$error = $APPLICATION->GetException()->GetString();
			$APPLICATION->ResetException();
		}

			$message = Loc::getMessage(
			'CATALOG_CONTROLLER_DOCUMENT_CANCEL_ERROR',
			[
				'#ERROR#' => $error,
			]
		);
		$this->addError(new Error($message));

		return null;
	}

	return true;
}

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