You are here

function commerce_reports_tax_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.

1 call to commerce_reports_tax_reportable_order_states()
commerce_reports_tax_views_default_views in modules/tax/includes/views/commerce_reports_tax.views_default.inc
Implements hook_views_default_views().

File

modules/tax/commerce_reports_tax.module, line 356
Module file for Commerce Reports Tax.

Code

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

    // 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;
}