You are here

function commerce_invoice_rules_condition_exists in Commerce Invoice 7

1 string reference to 'commerce_invoice_rules_condition_exists'
commerce_invoice_rules_condition_info in ./commerce_invoice.rules.inc
Implements hook_rules_condition_info()

File

./commerce_invoice.rules.inc, line 32
Rules integration for invoices.

Code

function commerce_invoice_rules_condition_exists($order) {
  $order_id = $order->order_id;
  $query = new EntityFieldQuery();
  $results = $query
    ->entityCondition('entity_type', 'commerce_invoice')
    ->propertyCondition('order_id', $order_id, '=')
    ->execute();
  if (isset($results['commerce_invoice'])) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}