Skip to content

Commit ec2c6ca

Browse files
committed
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
1 parent ab188bc commit ec2c6ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/code/Magento/Sales/Model/Service/InvoiceService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public function setVoid($id)
149149
*/
150150
public function prepareInvoice(Order $order, array $qtys = [])
151151
{
152+
$isQtysEmpty = empty($qtys);
152153
$invoice = $this->orderConverter->toInvoice($order);
153154
$totalQty = 0;
154155
$qtys = $this->prepareItemsQty($order, $qtys);
@@ -161,7 +162,7 @@ public function prepareInvoice(Order $order, array $qtys = [])
161162
$qty = (double) $qtys[$orderItem->getId()];
162163
} elseif ($orderItem->isDummy()) {
163164
$qty = $orderItem->getQtyOrdered() ? $orderItem->getQtyOrdered() : 1;
164-
} elseif (empty($qtys)) {
165+
} elseif ($isQtysEmpty) {
165166
$qty = $orderItem->getQtyToInvoice();
166167
} else {
167168
$qty = 0;

0 commit comments

Comments
 (0)