You are here

public static function InvoiceNumberPattern::getDefault in Commerce Invoice 7.2

Get the default invoice number pattern.

Return value

InvoiceNumberPattern

1 call to InvoiceNumberPattern::getDefault()
commerce_invoice_object_prepare_from_order in ./commerce_invoice.module
Prepares the invoice object but does not save it, nor it manipulates other invoices related to the given order.

File

src/Entity/InvoiceNumberPattern.php, line 30
Invoice Number Pattern entity

Class

InvoiceNumberPattern

Namespace

Drupal\commerce_invoice\Entity

Code

public static function getDefault() {
  $name = static::getDefaultName();
  $default = commerce_invoice_number_pattern_load($name);
  if (!$default) {
    watchdog('commerce_invoice', 'Failed to find default invoice number pattern: @name', [
      '@name' => $name,
    ], WATCHDOG_ERROR);
    return entity_create('commerce_invoice_number_pattern', [
      'name' => 'default',
      'label' => t('Default'),
      'pattern' => '',
    ]);
  }
  return $default;
}