From 66a664d8c2a764c52482eeda2a5dd5585017874e Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 20 Apr 2018 12:48:15 +0300 Subject: [PATCH] refactoring --- .../InventoryShipping/Observer/GetItemsToDeduct.php | 10 +++++----- .../inventory_shipping_source_selection_form.xml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/InventoryShipping/Observer/GetItemsToDeduct.php b/app/code/Magento/InventoryShipping/Observer/GetItemsToDeduct.php index 10a54c3ea9564..087b39c348d9e 100644 --- a/app/code/Magento/InventoryShipping/Observer/GetItemsToDeduct.php +++ b/app/code/Magento/InventoryShipping/Observer/GetItemsToDeduct.php @@ -59,7 +59,7 @@ public function execute(Item $shipmentItem): array if ($orderItem->isDummy(true)) { return []; } - $itemsToShip[] = $this->itemToDeduct->create($this->processComplexItem($shipmentItem)); + $itemsToShip[] = $this->processComplexItem($shipmentItem); } else { $itemSku = $shipmentItem->getSku() ?: $this->getSkusByProductIds->execute( [$shipmentItem->getProductId()] @@ -98,10 +98,10 @@ private function processComplexItem(Item $shipmentItem): array $itemSku = $item->getSku() ?: $this->getSkusByProductIds->execute( [$item->getProductId()] )[$item->getProductId()]; - $itemsToShip = [ + $itemsToShip = $this->itemToDeduct->create([ 'sku' => $itemSku, 'qty' => $qty - ]; + ]); continue; } } else { @@ -110,10 +110,10 @@ private function processComplexItem(Item $shipmentItem): array [$shipmentItem->getProductId()] )[$shipmentItem->getProductId()]; $qty = $this->castQty($orderItem, $shipmentItem->getQty()); - $itemsToShip =[ + $itemsToShip = $this->itemToDeduct->create([ 'sku' => $itemSku, 'qty' => $qty - ]; + ]); } } diff --git a/app/code/Magento/InventoryShipping/view/adminhtml/ui_component/inventory_shipping_source_selection_form.xml b/app/code/Magento/InventoryShipping/view/adminhtml/ui_component/inventory_shipping_source_selection_form.xml index ed81784a023e9..9e7f09aa17210 100644 --- a/app/code/Magento/InventoryShipping/view/adminhtml/ui_component/inventory_shipping_source_selection_form.xml +++ b/app/code/Magento/InventoryShipping/view/adminhtml/ui_component/inventory_shipping_source_selection_form.xml @@ -201,6 +201,7 @@ ${$.parentName}.qtyAvailable:value ns = ${ $.ns }, index = sourceCode:value + true