/**
* Set order status by order id
*
* @param int $orderId
* @param int $orderStatusId
* @param bool $sendStatusMail
* @param string|null $comment
*/
public function setOrderStatus($orderId,
$orderStatusId,
$sendStatusMail = false,
$comment = null
) { $previousStatusId =
$this->
getOrderStatus($orderId);
if ($orderStatusId ==
$previousStatusId) { return;
} $this->db->
executeUpdate( 'UPDATE s_order SET status = :status WHERE id = :orderId;',
[':status' =>
$orderStatusId, ':orderId' =>
$orderId] );
$sql = '
INSERT INTO s_order_history (
orderID, userID, previous_order_status_id, order_status_id,
previous_payment_status_id, payment_status_id, comment, change_date )
SELECT id, NULL, :previousStatus, :currentStatus, cleared, cleared, :comment, NOW() FROM s_order WHERE id = :orderId
';