File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
app/code/Magento/Sales/Controller/Adminhtml/Order Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 66namespace Magento \Sales \Controller \Adminhtml \Order ;
77
88use Magento \Framework \App \Action \HttpPostActionInterface ;
9- use Magento \Sales \Model \ Order ;
9+ use Magento \Sales \Api \ Data \ OrderInterface ;
1010use Magento \Sales \Model \Order \Email \Sender \OrderCommentSender ;
1111
1212/**
@@ -45,7 +45,7 @@ public function execute()
4545 throw new \Magento \Framework \Exception \LocalizedException (__ ($ error ));
4646 }
4747
48- $ orderStatus = $ this ->getOrderStatus ($ order-> getDataByKey ( ' status ' ) , $ data ['status ' ]);
48+ $ orderStatus = $ this ->getOrderStatus ($ order , $ data ['status ' ]);
4949 $ order ->setStatus ($ orderStatus );
5050 $ notify = $ data ['is_customer_notified ' ] ?? false ;
5151 $ visible = $ data ['is_visible_on_front ' ] ?? false ;
@@ -89,9 +89,13 @@ public function execute()
8989 * @param string $historyStatus
9090 * @return string
9191 */
92- private function getOrderStatus (string $ orderStatus , string $ historyStatus ): string
92+ private function getOrderStatus (OrderInterface $ order , string $ historyStatus ): string
9393 {
94- return ($ orderStatus === Order::STATE_PROCESSING || $ orderStatus === Order::STATUS_FRAUD ) ? $ historyStatus
95- : $ orderStatus ;
94+ $ statuses = $ order ->getConfig ()->getStateStatuses ($ order ->getState ());
95+
96+ if (!in_array ($ historyStatus , array_keys ($ statuses ))) {
97+ return $ order ->getDataByKey ('status ' );
98+ }
99+ return $ historyStatus ;
96100 }
97101}
You can’t perform that action at this time.
0 commit comments