You are here

function commerce_invoice_load_current in Commerce Invoice 7.2

Load the current invoice for an order.

Parameters

object $order:

Return value

Invoice|FALSE

6 calls to commerce_invoice_load_current()
CommerceInvoiceTestCase::testInvoiceCreationAndPayment in tests/commerce_invoice.test
Tests creation and payment of an Invoice.
commerce_invoice_action_load_current in ./commerce_invoice.rules.inc
Rules action: Fetch current invoice in order.
commerce_invoice_order_changed in ./commerce_invoice.module
Determine whether an order has changed since its current invoice.
commerce_invoice_order_has_invoice in ./commerce_invoice.rules.inc
Rules condition: whether the order has a current invoice.
PdfOrderFieldHandler::render in modules/pdf/src/Views/PdfOrderFieldHandler.php
Overrides parent::render().

... See full list

File

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

Code

function commerce_invoice_load_current($order) {
  $invoices = commerce_invoice_load_for_order($order, [
    [
      'invoice_status',
      Invoice::STATUS_CANCELED,
      '<>',
    ],
  ], 1, 'created', TRUE);
  return reset($invoices);
}