Merge pull request #4835 from bagisto-europe/update_order

Define a custom order status
This commit is contained in:
Glenn Hermans 2021-05-02 19:52:32 +02:00 committed by GitHub
commit 9e2e54af5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions

View File

@ -304,18 +304,22 @@ class OrderRepository extends Repository
* @param \Webkul\Sales\Contracts\Order $order
* @return void
*/
public function updateOrderStatus($order)
public function updateOrderStatus($order, $orderState = null)
{
$status = 'processing';
if (!empty($orderState)) {
$status = $orderState;
} else {
$status = "processing";
if ($this->isInCompletedState($order)) {
$status = 'completed';
}
if ($this->isInCompletedState($order)) {
$status = 'completed';
}
if ($this->isInCanceledState($order)) {
$status = 'canceled';
} elseif ($this->isInClosedState($order)) {
$status = 'closed';
if ($this->isInCanceledState($order)) {
$status = 'canceled';
} elseif ($this->isInClosedState($order)) {
$status = 'closed';
}
}
$order->status = $status;