You are here

function uc_order_ca_condition in Ubercart 6.2

Implements hook_ca_condition().

File

uc_order/uc_order.ca.inc, line 127
This file contains the Conditional Actions hooks and functions necessary to make the order related entity, conditions, events, and actions work.

Code

function uc_order_ca_condition() {
  $order_arg = array(
    '#entity' => 'uc_order',
  );
  $conditions['uc_order_status_condition'] = array(
    '#title' => t('Check the order status'),
    '#description' => t('Returns TRUE if the current order status matches the status specified below.'),
    '#category' => t('Order'),
    '#callback' => 'uc_order_condition_check_order_status',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_state_condition'] = array(
    '#title' => t('Check the order state'),
    '#description' => t('Returns TRUE if the current order status belong to the order state specified below.'),
    '#category' => t('Order'),
    '#callback' => 'uc_order_condition_check_order_state',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_total'] = array(
    '#title' => t('Check the order total'),
    '#description' => t('Returns TRUE if the current order total is within the parameters below.'),
    '#category' => t('Order'),
    '#callback' => 'uc_order_condition_total',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_delivery_postal_code'] = array(
    '#title' => t("Check an order's shipping postal code"),
    '#category' => t('Order: Shipping address'),
    '#description' => t('Returns TRUE if the shipping postal code is in the specified area.'),
    '#callback' => 'uc_order_condition_delivery_postal_code',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_delivery_zone'] = array(
    '#title' => t("Check an order's shipping @zone", array(
      '@zone' => uc_get_field_name('zone'),
    )),
    '#category' => t('Order: Shipping address'),
    '#description' => t('Returns TRUE if the shipping @zone is in the specified list.', array(
      '@zone' => uc_get_field_name('zone'),
    )),
    '#callback' => 'uc_order_condition_delivery_zone',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_delivery_country'] = array(
    '#title' => t("Check an order's shipping country"),
    '#category' => t('Order: Shipping address'),
    '#description' => t('Returns TRUE if the shipping country is in the specified list.'),
    '#callback' => 'uc_order_condition_delivery_country',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_billing_postal_code'] = array(
    '#title' => t("Check an order's billing postal code"),
    '#category' => t('Order: Billing address'),
    '#description' => t('Returns TRUE if the billing postal code is in the specified area.'),
    '#callback' => 'uc_order_condition_billing_postal_code',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_billing_zone'] = array(
    '#title' => t("Check an order's billing @zone", array(
      '@zone' => uc_get_field_name('zone'),
    )),
    '#category' => t('Order: Billing address'),
    '#description' => t('Returns TRUE if the billing @zone is in the specified list.', array(
      '@zone' => uc_get_field_name('zone'),
    )),
    '#callback' => 'uc_order_condition_billing_zone',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_billing_country'] = array(
    '#title' => t("Check an order's billing country"),
    '#category' => t('Order: Billing address'),
    '#description' => t('Returns TRUE if the billing country is in the specified list.'),
    '#callback' => 'uc_order_condition_billing_country',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_has_products'] = array(
    '#title' => t("Check an order's products"),
    '#category' => t('Order: Product'),
    '#description' => t('Returns TRUE if the order has any, all, or only the products in the list.'),
    '#callback' => 'uc_order_condition_has_products',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_count_products'] = array(
    '#title' => t("Check an order's number of products"),
    '#category' => t('Order: Product'),
    '#description' => t('Determines if the order has the specified number of products, possibly of a certain type.'),
    '#callback' => 'uc_order_condition_count_products',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_products_weight'] = array(
    '#title' => t("Check an order's total weight"),
    '#category' => t('Order: Product'),
    '#description' => t('Determines if the order has the specified weight, possibly counting only a certain type of product.'),
    '#callback' => 'uc_order_condition_products_weight',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_is_shippable'] = array(
    '#title' => t('Check if an order can be shipped'),
    '#category' => t('Order'),
    '#description' => t('Returns TRUE if the order has any shippable products.'),
    '#callback' => 'uc_order_condition_is_shippable',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_user_name'] = array(
    '#title' => t('Check the user name.'),
    '#category' => t('Order: User'),
    '#description' => t('Returns TRUE if the user name matches the condition.'),
    '#callback' => 'uc_order_condition_user_name',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_user_mail'] = array(
    '#title' => t('Check the user email address.'),
    '#category' => t('Order: User'),
    '#description' => t('Returns TRUE if the user email addresses matches the condition.'),
    '#callback' => 'uc_order_condition_user_mail',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_user_created'] = array(
    '#title' => t('Check the user creation date.'),
    '#category' => t('Order: User'),
    '#description' => t('Returns TRUE if the user creation date matches the condition.'),
    '#callback' => 'uc_order_condition_user_created',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_user_login'] = array(
    '#title' => t('Check the user last login date.'),
    '#category' => t('Order: User'),
    '#description' => t('Returns TRUE if the user last login date matches the condition.'),
    '#callback' => 'uc_order_condition_user_login',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_user_language'] = array(
    '#title' => t('Check the user language setting.'),
    '#category' => t('Order: User'),
    '#description' => t('Returns TRUE if the user language setting matches the condition.'),
    '#callback' => 'uc_order_condition_user_language',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  $conditions['uc_order_condition_user_roles'] = array(
    '#title' => t('Check the role of the user.'),
    '#category' => t('Order: User'),
    '#description' => t('Returns TRUE if the user roles match your settings.'),
    '#callback' => 'uc_order_condition_user_roles',
    '#arguments' => array(
      'order' => $order_arg,
    ),
  );
  return $conditions;
}