| @@ 48-55 (lines=8) @@ | ||
| 45 | $qty = $item->getQtyOrdered() - max($item->getQtyShipped(), $item->getQtyInvoiced()) - $item->getQtyCanceled(); |
|
| 46 | if ($item->getId() && $item->getProductId() && empty($children) && $qty) { |
|
| 47 | $reserve = $this->stockbaseStockManagement->getReserveForQuoteItem($item->getQuoteItemId()); |
|
| 48 | if (!empty($reserve)) { |
|
| 49 | $reserve = reset($reserve); |
|
| 50 | $qty -= $reserve->getAmount(); |
|
| 51 | //if ($qty != $reserve->getMagentoStockAmount()) { |
|
| 52 | // throw new \Exception('Invalid quote inventory revert.'); //TODO: Enable additional checks |
|
| 53 | //} |
|
| 54 | $this->stockbaseStockManagement->releaseReserve($reserve); |
|
| 55 | } |
|
| 56 | $this->stockManagement->backItemQty($item->getProductId(), $qty, $item->getStore()->getWebsiteId()); |
|
| 57 | } |
|
| 58 | $this->priceIndexer->reindexRow($item->getProductId()); |
|
| @@ 65-72 (lines=8) @@ | ||
| 62 | ||
| 63 | $amount = $childItem->getTotalQty(); |
|
| 64 | $reserve = $this->stockbaseStockManagement->getReserveForQuoteItem($childItem->getId()); |
|
| 65 | if (!empty($reserve)) { |
|
| 66 | $reserve = reset($reserve); |
|
| 67 | $amount -= $reserve->getAmount(); |
|
| 68 | //if ($amount != $reserve->getMagentoStockAmount()) { |
|
| 69 | // throw new \Exception('Invalid quote inventory revert.'); //TODO: Enable additional checks |
|
| 70 | //} |
|
| 71 | $this->stockbaseStockManagement->releaseReserve($reserve); |
|
| 72 | } |
|
| 73 | if (!isset($items[$productId])) { |
|
| 74 | $items[$productId] = 0; |
|
| 75 | } |
|