Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions common/models/OrderHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,16 @@ public static function addOrderHistory($order_uuid, $status, $note) {
->andWhere(['order_uuid' => $order_uuid])
->one();

if (!$order) {
Yii::error('Order not found while adding order history: ' . $order_uuid);
throw new \yii\base\Exception('Order not found while adding order history.');
}

$order->scenario = "updateStatus";
$order->order_status = $status;
if (!$order->save()) {
Yii::error($order->errors);
print_r($order->errors);
die();
throw new \yii\base\Exception('Unable to update order status while adding order history.');
}

$model = new OrderHistory();
Expand All @@ -142,8 +146,7 @@ public static function addOrderHistory($order_uuid, $status, $note) {
$model->comment = $note;
if (!$model->save()) {
Yii::error($model->errors);
print_r($model->errors);
die();
throw new \yii\base\Exception('Unable to save order history.');
}
}

Expand Down