21 public function createAction(array $shipmentIds, array $additional = [],
int $deliveryId =
null)
23 if (!$this->checkPermission(
'U'))
28 if (is_null($deliveryId))
30 if ($shipmentIds && $shipmentIds[0])
32 $shipment = ShipmentRepository::getInstance()->getById((
int)$shipmentIds[0]);
33 if ($shipment && $shipment->getDelivery())
35 $deliveryId = $shipment->getDelivery()->getId();
41 $result = Requests\Manager::createDeliveryRequest($deliveryId, $shipmentIds, $additional);
43 if (!$result->isSuccess())
51 'message' => $this->getMessageFromResult($result)
61 public function executeAction(
int $requestId,
string $actionType, array $additional = [])
63 if (!$this->checkPermission(
'U'))
69 $result = Requests\Manager::executeDeliveryRequestAction($requestId, $actionType, $additional);
71 if (!$result->isSuccess())
79 'message' => $this->getMessageFromResult($result)
87 public function deleteAction(
int $requestId)
89 if (!$this->checkPermission(
'U'))
95 $result = Requests\Manager::deleteDeliveryRequest($requestId);
97 if (!$result->isSuccess())
105 'message' => $this->getMessageFromResult($result)
113 private function getMessageFromResult(Requests\
Result $result):
string
120 return $message->getMessage();
122 $result->getMessages()
131 private function checkPermission(
string $permissionType):
bool
133 $result =
$GLOBALS[
'APPLICATION']->GetGroupRight(
'sale') >= $permissionType;
$GLOBALS['____1444769544']