- Модуль: catalogmobile
- Путь к файлу: ~/bitrix/modules/catalogmobile/lib/Controller/StoreDocument.php
- Класс: BitrixCatalogMobileControllerStoreDocument
- Вызов: StoreDocument::setShipped
private function setShipped(int $id, string $shipped): ?array
{
if (!Loader::requireModule('crm'))
{
$this->addError(new Error('Module crm is not installed'));
return null;
}
$this->forward(
RealizationDocument::class,
'setShipped',
[
'id' => $id,
'value' => $shipped,
]
);
if (!empty($this->getErrors()))
{
return null;
}
$statuses = $this->getStatusesList();
$status = $shipped === 'Y' ? CCatalogDocs::CONDUCTED : CCatalogDocs::CANCELLED;
$shipment = ShipmentRepository::getInstance()->getById($id);
if (!$shipment)
{
return null;
}
$fields = $shipment->getFields()->getValues();
$fields['DOC_TYPE'] = 'W';
PullManager::getInstance()->sendDocumentsUpdatedEvent([
[
'id' => $shipment->getId(),
'data' => [
'fields' => $fields,
],
],
]);
return [
'result' => true,
'item' => [
'statuses' => [
$status,
],
'fields' => [
[
'name' => 'DOC_STATUS',
'value' => [
$statuses[$status],
]
],
],
],
];
}