• Модуль: catalogmobile
  • Путь к файлу: ~/bitrix/modules/catalogmobile/lib/Controller/StoreDocument.php
  • Класс: BitrixCatalogMobileControllerStoreDocument
  • Вызов: StoreDocument::deleteAction
public function deleteAction(int $id, string $docType, CurrentUser $currentUser): ?array
{
	if ($docType === StoreDocumentTable::TYPE_SALES_ORDERS)
	{
		return $this->deleteRealization($id);
	}
	if (!$this->checkDocumentAccess(ActionDictionary::ACTION_STORE_DOCUMENT_DELETE, $id, $currentUser))
	{
		$this->addError(new Error(Loc::getMessage('MOBILE_CONTROLLER_CATALOG_ERROR_DELETE_PERMS')));

		return null;
	}

	$result = CCatalogDocs::delete($id);
	if (!$result)
	{
		$this->addError(
			$this->getLastApplicationError()
				?: new Error(Loc::getMessage('MOBILE_CONTROLLER_CATALOG_ERROR_DELETE'))
		);

		return null;
	}

	return [
		'result' => $result,
	];
}