You are here

function commerce_invoice_rules_action_info in Commerce Invoice 7.2

Same name and namespace in other branches
  1. 7 commerce_invoice.rules.inc \commerce_invoice_rules_action_info()

Implements hook_rules_action_info().

File

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

Code

function commerce_invoice_rules_action_info() {
  $actions = array();
  $actions['commerce_invoice_create_from_order'] = array(
    'base' => 'commerce_invoice_action_create_from_order',
    'label' => t('Create an invoice'),
    'parameter' => array(
      'order' => array(
        'type' => 'commerce_order',
        'label' => t('The order'),
      ),
      'pattern' => array(
        'type' => 'commerce_invoice_number_pattern',
        'label' => t('The invoice number pattern'),
        'optional' => TRUE,
        'options list' => 'commerce_invoice_number_pattern_options_list',
        'default value' => \Drupal\commerce_invoice\Entity\InvoiceNumberPattern::getDefaultName(),
      ),
      'cancel_existing' => array(
        'type' => 'boolean',
        'label' => t('Cancel existing'),
        'description' => t('Cancel all other invoices for the order.'),
        'default value' => TRUE,
      ),
    ),
    'provides' => array(
      'commerce_invoice' => array(
        'type' => 'commerce_invoice',
        'label' => t('Created invoice'),
      ),
    ),
    'group' => t('Commerce Invoice'),
  );
  $actions['commerce_invoice_load_current'] = array(
    'base' => 'commerce_invoice_action_load_current',
    'label' => t('Fetch current invoice in order'),
    'parameter' => array(
      'order' => array(
        'type' => 'commerce_order',
        'label' => t('The order'),
      ),
    ),
    'provides' => array(
      'commerce_invoice' => array(
        'type' => 'commerce_invoice',
        'label' => t('Fetched invoice'),
      ),
    ),
    'group' => t('Commerce Invoice'),
  );
  return $actions;
}