You are here

function commerce_order_is_latest_revision in Commerce Core 7

Determines whether or not the given order object represents the latest revision of the order.

Parameters

$order: A fully loaded order object.

Return value

Boolean indicating whether or not the order object represents the latest revision of the order.

2 calls to commerce_order_is_latest_revision()
commerce_cart_commerce_order_load in modules/cart/commerce_cart.module
Implements hook_commerce_order_load().
commerce_checkout_router in modules/checkout/includes/commerce_checkout.pages.inc
Redirects invalid checkout attempts or displays the checkout form if valid.

File

modules/order/commerce_order.module, line 801
Defines the core Commerce order entity and API functions to manage orders and interact with them.

Code

function commerce_order_is_latest_revision($order) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'commerce_order', '=')
    ->propertyCondition('order_id', $order->order_id, '=')
    ->propertyCondition('revision_id', $order->revision_id, '=');
  $result = $query
    ->execute();
  return !empty($result) ? TRUE : FALSE;
}