You are here

function commerce_invoice_ui_invoice_view_by_order in Commerce Invoice 7

Generate an array for rendering the given invoice, based on an order.

Parameters

$order: A fully loaded order object.

$view_mode: The view mode for displaying the invoice, 'administrator' or 'customer'.

Return value

An array as expected by drupal_render().

1 string reference to 'commerce_invoice_ui_invoice_view_by_order'
commerce_invoice_ui_menu in ./commerce_invoice_ui.module
Implements hook_menu().

File

./commerce_invoice_ui.module, line 127

Code

function commerce_invoice_ui_invoice_view_by_order($order, $view_mode = 'administrator', $breadcrumb = TRUE) {
  $invoice = commerce_invoice_load_by_order_id($order->order_id);
  if ($invoice) {
    return commerce_invoice_ui_invoice_view($invoice, $view_mode, $breadcrumb);
  }
  else {
    drupal_set_message(t('The invoice for this order has not been generated yet'), 'warning');
    return '';
  }
}