From ec2c6ca7df68de9aaccecfb899b102a2a3eaa631 Mon Sep 17 00:00:00 2001 From: Ryan Palmer Date: Wed, 10 Apr 2019 10:28:51 +0100 Subject: [PATCH] Prevented /Magento/Sales/Model/Service/InvoiceService.php incorrectly discarding simple items when bundle items are mixed in a call to prepareInvoice without any qtys specified Renamed emptyQtys to isQtysEmpty --- app/code/Magento/Sales/Model/Service/InvoiceService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/Model/Service/InvoiceService.php b/app/code/Magento/Sales/Model/Service/InvoiceService.php index 02242e92c8bf5..18efeba726c1b 100644 --- a/app/code/Magento/Sales/Model/Service/InvoiceService.php +++ b/app/code/Magento/Sales/Model/Service/InvoiceService.php @@ -149,6 +149,7 @@ public function setVoid($id) */ public function prepareInvoice(Order $order, array $qtys = []) { + $isQtysEmpty = empty($qtys); $invoice = $this->orderConverter->toInvoice($order); $totalQty = 0; $qtys = $this->prepareItemsQty($order, $qtys); @@ -161,7 +162,7 @@ public function prepareInvoice(Order $order, array $qtys = []) $qty = (double) $qtys[$orderItem->getId()]; } elseif ($orderItem->isDummy()) { $qty = $orderItem->getQtyOrdered() ? $orderItem->getQtyOrdered() : 1; - } elseif (empty($qtys)) { + } elseif ($isQtysEmpty) { $qty = $orderItem->getQtyToInvoice(); } else { $qty = 0;