File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -89,13 +89,18 @@ public function __construct(
89
89
protected function _prepareShipment ($ invoice )
90
90
{
91
91
$ invoiceData = $ this ->getRequest ()->getParam ('invoice ' );
92
-
92
+ $ itemArr = [];
93
+ if (!isset ($ invoiceData ['items ' ]) || empty ($ invoiceData ['items ' ])) {
94
+ $ orderItems = $ invoice ->getOrder ()->getItems ();
95
+ foreach ($ orderItems as $ item ) {
96
+ $ itemArr [$ item ->getId ()] = (int )$ item ->getQtyOrdered ();
97
+ }
98
+ }
93
99
$ shipment = $ this ->shipmentFactory ->create (
94
100
$ invoice ->getOrder (),
95
- isset ($ invoiceData ['items ' ]) ? $ invoiceData ['items ' ] : [] ,
101
+ isset ($ invoiceData ['items ' ]) ? $ invoiceData ['items ' ] : $ itemArr ,
96
102
$ this ->getRequest ()->getPost ('tracking ' )
97
103
);
98
-
99
104
if (!$ shipment ->getTotalQty ()) {
100
105
return false ;
101
106
}
You can’t perform that action at this time.
0 commit comments