Open
Description
We are seeing some error statements like 2020-09-07T07:38:47+00:00 ERR (3): Notice: Undefined index: qty in app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php on line 850
the qty variable is not present in the $data object, the error is created here https://github.com/OpenMage/magento-lts/blob/1.9.4.x/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php#L850
I guess only a couple of causes can exist?
- the CreateController action is triggered by post data containing
update_items
but missing qty param? - qty param logic in updateQuoteItems is flawed and if empty should be 0 or maybe the function should return immediately because there is not qty to update to ...
- the CreateController action update_items should no longer used?
Only location where "updateQuoteItems" is mentioned app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php
/**
* Update quote items
*/
if ($this->getRequest()->getPost('update_items')) {
$items = $this->getRequest()->getPost('item', array());
$items = $this->_processFiles($items);
$this->_getOrderCreateModel()->updateQuoteItems($items);
}
Preconditions (*)
- php 7.2 LTS 20.x
Steps to reproduce (*)
- Not certain, I am adding some logging to identify the route that was accessed and log full request
Expected result (*)
- No error
Actual result (*)
2020-09-07T07:38:47+00:00 ERR (3): Notice: Undefined index: qty in app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php on line 850
A possible fix could be to leave the qty alone?
if (array_key_exists('qty', $info)) {
$itemQty = (float)$info['qty'];
} else {
$itemQty = $item->getQty();
}