You are here

function commerce_reports_reportable_order_states in Commerce Reporting 7.4

Returns the order states to report on.

Return value

array Array of order states for Views to filter on.

4 calls to commerce_reports_reportable_order_states()
commerce_reports_tax_reportable_order_states in modules/tax/commerce_reports_tax.module
Returns the order states to report on.
_commerce_reports_views_default_customer_views in includes/views/commerce_reports.views_default.customers.inc
@file Customer View Displays
_commerce_reports_views_default_products_views in includes/views/commerce_reports.views_default.products.inc
@file Products View Displays
_commerce_reports_views_default_sales_views in includes/views/commerce_reports.views_default.sales.inc
@file Sales View Displays
1 string reference to 'commerce_reports_reportable_order_states'
commerce_reports_tax_reportable_order_states in modules/tax/commerce_reports_tax.module
Returns the order states to report on.

File

./commerce_reports.module, line 291
Module file for Commerce Reports.

Code

function commerce_reports_reportable_order_states() {
  $cache =& drupal_static(__FUNCTION__, array());
  if (empty($cache)) {
    $report_states = array(
      'pending',
      'completed',
    );
    drupal_alter('commerce_reports_reportable_order_states', $report_states);

    // Validate states.
    $order_states = commerce_order_states();
    foreach ($report_states as $state) {
      if (!in_array($state, $order_states)) {
        unset($report_states[$state]);
      }
    }

    // Use array_combine to match View's 'value' => 'value',
    $cache = array_combine($report_states, $report_states);
  }
  return $cache;
}