You are here

function uc_order_state_default in Ubercart 5

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

Return 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.

7 calls to uc_order_state_default()
uc_cart_checkout_form_validate in uc_cart/uc_cart.module
uc_cart_complete_sale in uc_cart/uc_cart.module
Completes a sale, including adjusting order status and creating user account.
uc_checkout_pane_comments in uc_cart/uc_cart_checkout_pane.inc
Allow a customer to make comments on the order.
uc_credit_cron in payment/uc_credit/uc_credit.module
Implementation of hook_cron().
uc_order_new in uc_order/uc_order.module
Generate a new order for user $uid.

... See full list

File

uc_order/uc_order.module, line 3053

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