We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit 403f01e1 authored by rikterbeek's avatar rikterbeek

Fixes #48 set the correct flag so magento can cancel() or hold() the order

parent d239bb74
......@@ -35,6 +35,7 @@ class Cron
*/
protected $_logger;
/**
* @var Resource\Notification\CollectionFactory
*/
......@@ -570,9 +571,12 @@ class Cron
// check if order has in invoice only cancel/hold if this is not the case
if ($ignoreHasInvoice || !$this->_order->hasInvoices()) {
$this->_order->setActionFlag($orderStatus, true);
if ($orderStatus == \Magento\Sales\Model\Order::STATE_HOLDED) {
// Allow magento to hold order
$this->_order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_HOLD, true);
if ($this->_order->canHold()) {
$this->_order->hold();
} else {
......@@ -580,6 +584,9 @@ class Cron
return;
}
} else {
// Allow magento to cancel order
$this->_order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_CANCEL, true);
if ($this->_order->canCancel()) {
$this->_order->cancel();
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment