- Модуль: catalogmobile
- Путь к файлу: ~/bitrix/modules/catalogmobile/lib/Controller/StoreDocument.php
- Класс: BitrixCatalogMobileControllerStoreDocument
- Вызов: StoreDocument::cancellationAction
public function cancellationAction(int $id, string $docType, CurrentUser $currentUser): ?array
{
if ($docType === StoreDocumentTable::TYPE_SALES_ORDERS)
{
return $this->setShipped($id, 'N');
}
if (!$this->checkDocumentAccess(ActionDictionary::ACTION_STORE_DOCUMENT_CONDUCT, $id, $currentUser))
{
$this->addError(new Error(Loc::getMessage('MOBILE_CONTROLLER_CATALOG_ERROR_CANCELLATION_PERMS')));
return null;
}
$result = CCatalogDocs::cancellationDocument($id, $currentUser->getId());
if (!$result)
{
$this->addError(
$this->getLastApplicationError()
?: new Error(Loc::getMessage('MOBILE_CONTROLLER_CATALOG_ERROR_CANCELLATION'))
);
return null;
}
$statuses = $this->getStatusesList();
return [
'result' => $result,
'item' => [
'statuses' => [
CCatalogDocs::CANCELLED,
],
'fields' => [
[
'name' => 'DOC_STATUS',
'value' => [
$statuses[CCatalogDocs::CANCELLED],
]
],
],
],
];
}