You are here

function uc_order_state_default in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_order/uc_order.module \uc_order_state_default()
  2. 5 uc_order/uc_order.module \uc_order_state_default()
  3. 6.2 uc_order/uc_order.module \uc_order_state_default()

Returns the default order status for a particular order state.

Parameters

$state_id: The ID of the order state whose default status you want to find.

Return value

A string containing the default order status ID for the specified state.

6 calls to uc_order_state_default()
UcOrder::__construct in uc_order/uc_order.module
Order object constructor.
uc_2checkout_process_notification in payment/uc_2checkout/uc_2checkout.pages.inc
React on status changes from 2CO.
uc_cart_complete_sale in uc_cart/uc_cart.module
Completes a sale, including adjusting order status and creating user account.
uc_checkout_pane_callback in uc_cart/uc_cart.api.php
Builds and proceses a pane defined by hook_uc_checkout_pane().
uc_checkout_pane_comments in uc_cart/uc_cart_checkout_pane.inc
Allows a customer to make comments on the order.

... See full list

File

uc_order/uc_order.module, line 1956

Code

function uc_order_state_default($state_id) {
  static $default;

  // Return the default value if it exists.
  if (isset($default[$state_id])) {
    return $default[$state_id];
  }

  // Attempt to get the default state from the form.
  $default[$state_id] = variable_get('uc_state_' . $state_id . '_default', NULL);

  // If it is not found, pick the lightest status for this state.
  if (empty($default[$state_id])) {
    $statuses = uc_order_status_list($state_id);
    $default[$state_id] = $statuses[0]['id'];
  }
  return $default[$state_id];
}