You are here

function commerce_invoice_order_changed in Commerce Invoice 7.2

Determine whether an order has changed since its current invoice.

Parameters

object $order: The Commerce order object.

Return value

bool TRUE if the order has changed since the current invoice, FALSE otherwise.

File

./commerce_invoice.module, line 316
The Commerce Invoice module.

Code

function commerce_invoice_order_changed($order) {
  $invoice = commerce_invoice_load_current($order);
  if (!$invoice) {
    return TRUE;
  }

  // @todo this needs to be actually logical...
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  $total_changed = $invoice
    ->wrapper()->commerce_invoice_total
    ->value() != $order_wrapper->commerce_order_total
    ->value();
  return $total_changed;
}