You are here

function commerce_invoice_action_create_from_order in Commerce Invoice 7.2

Action: Create invoice for a given order.

1 string reference to 'commerce_invoice_action_create_from_order'
commerce_invoice_rules_action_info in ./commerce_invoice.rules.inc
Implements hook_rules_action_info().

File

./commerce_invoice.rules.inc, line 116
Rules integration for the Commerce Invoice module.

Code

function commerce_invoice_action_create_from_order($order, $pattern = NULL, $cancel_existing = TRUE) {
  if (is_string($pattern)) {
    $pattern = commerce_invoice_number_pattern_load($pattern);
  }
  $invoice = commerce_invoice_create_from_order($order, $pattern, $cancel_existing);
  return [
    'commerce_invoice' => $invoice,
  ];
}