We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday 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 ...@@ -35,6 +35,7 @@ class Cron
*/ */
protected $_logger; protected $_logger;
/** /**
* @var Resource\Notification\CollectionFactory * @var Resource\Notification\CollectionFactory
*/ */
...@@ -570,9 +571,12 @@ class Cron ...@@ -570,9 +571,12 @@ class Cron
// check if order has in invoice only cancel/hold if this is not the case // check if order has in invoice only cancel/hold if this is not the case
if ($ignoreHasInvoice || !$this->_order->hasInvoices()) { if ($ignoreHasInvoice || !$this->_order->hasInvoices()) {
$this->_order->setActionFlag($orderStatus, true);
if ($orderStatus == \Magento\Sales\Model\Order::STATE_HOLDED) { 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()) { if ($this->_order->canHold()) {
$this->_order->hold(); $this->_order->hold();
} else { } else {
...@@ -580,6 +584,9 @@ class Cron ...@@ -580,6 +584,9 @@ class Cron
return; return;
} }
} else { } else {
// Allow magento to cancel order
$this->_order->setActionFlag(\Magento\Sales\Model\Order::ACTION_FLAG_CANCEL, true);
if ($this->_order->canCancel()) { if ($this->_order->canCancel()) {
$this->_order->cancel(); $this->_order->cancel();
} else { } 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