diff --git a/uc_order/uc_order.rules.inc b/uc_order/uc_order.rules.inc index 0167bf4..e4881ce 100644 --- a/uc_order/uc_order.rules.inc +++ b/uc_order/uc_order.rules.inc @@ -143,7 +143,7 @@ function uc_order_rules_condition_info() { 'products' => array( 'type' => 'list', 'label' => t('Products'), - 'options list' => 'uc_order_condition_has_products_options', + 'options list' => 'uc_order_condition_products_options', 'restriction' => 'input', ), 'required' => array( @@ -169,7 +169,7 @@ function uc_order_rules_condition_info() { 'products' => array( 'type' => 'list', 'label' => t('Products'), - 'options list' => 'uc_order_condition_products_options', + 'options list' => 'uc_order_condition_products_and_all_options', 'restriction' => 'input', ), 'product_count_value' => array( @@ -196,7 +196,7 @@ function uc_order_rules_condition_info() { 'products' => array( 'type' => 'list', 'label' => t('Products'), - 'options list' => 'uc_order_condition_products_options', + 'options list' => 'uc_order_condition_products_and_all_options', 'restriction' => 'input', ), 'weight_units' => array( @@ -346,6 +346,8 @@ function uc_order_rules_action_info() { /** * Checks the current order state. + * + * @see uc_order_rules_condition_info() */ function uc_order_condition_order_state($order, $order_state) { return uc_order_status_data($order->order_status, 'state') == $order_state; @@ -354,7 +356,10 @@ function uc_order_condition_order_state($order, $order_state) { /** * Options callback. * + * Returns list of all possible states, indexed by ID. + * * @see uc_order_condition_order_state() + * @see uc_order_rules_condition_info() */ function uc_order_condition_order_state_options() { foreach (uc_order_state_list('general') as $id => $state) { @@ -369,6 +374,8 @@ function uc_order_condition_order_state_options() { /** * Checks that the order has one of the selected delivery countries. + * + * @see uc_order_rules_condition_info() */ function uc_order_condition_delivery_country($order, $countries) { return in_array($order->delivery_country, $countries); @@ -376,6 +383,8 @@ function uc_order_condition_delivery_country($order, $countries) { /** * Checks that the order has one of the selected billing countries. + * + * @see uc_order_rules_condition_info() */ function uc_order_condition_billing_country($order, $countries) { return in_array($order->billing_country, $countries); @@ -383,6 +392,8 @@ function uc_order_condition_billing_country($order, $countries) { /** * Checks that the order has the selected combination of products. + * + * @see uc_order_rules_condition_info() */ function uc_order_condition_has_products($order, $products, $required, $forbidden) { $order_products = array(); @@ -409,9 +420,13 @@ function uc_order_condition_has_products($order, $products, $required, $forbidde /** * Options callback. * + * Lists SKUs and titles for all products, including variations + * due to attributes. + * + * @see uc_order_rules_condition_info() * @see uc_order_condition_has_products() */ -function uc_order_condition_has_products_options() { +function uc_order_condition_products_options() { $options = array(); $result = db_query("SELECT nid FROM {uc_products}"); foreach ($result as $row) { @@ -423,9 +438,25 @@ function uc_order_condition_has_products_options() { } /** + * Options callback. + * + * Lists SKUs and titles for all products, including variations due to + * attributes. Also includes an "all" option at the front of the list. + * + * @see uc_order_rules_condition_info() + * @see uc_order_condition_count_products() + * @see uc_order_condition_products_weight() + */ +function uc_order_condition_products_and_all_options() { + $options = array('all' => t('- All products -')); + $options += uc_order_condition_products_options(); + return $options; +} + +/** * Checks that the order has the selected number of products. * - * @see uc_order_condition_count_products_form() + * @see uc_order_rules_condition_info() */ function uc_order_condition_count_products($order, $products, $count, $op) { $totals = array('all' => 0); @@ -464,17 +495,13 @@ function uc_order_condition_count_products($order, $products, $count, $op) { } /** - * Product options callback. - */ -function uc_order_condition_products_options() { - $options = array('all' => t('- All products -')); - $options += db_query("SELECT nid, model FROM {uc_products} ORDER BY model")->fetchAllKeyed(); - - return $options; -} - -/** - * Operator options callback. + * Options callback. + * + * List of numerical comparison operators written out. + * + * @see uc_order_rules_condition_info() + * @see uc_order_condition_products_weight() + * @see uc_order_condition_count_products() */ function uc_order_condition_value_operator_options() { return array( @@ -489,7 +516,7 @@ function uc_order_condition_value_operator_options() { /** * Checks the weight of the order's products. * - * @see uc_order_condition_products_weight_form() + * @see uc_order_rules_condition_info() */ function uc_order_condition_products_weight($order, $products, $weight_units, $weight_value, $op) { $totals = array('all' => 0); @@ -525,6 +552,8 @@ function uc_order_condition_products_weight($order, $products, $weight_units, $w /** * Weight units options callback. + * + * @see uc_order_rules_condition_info() */ function uc_order_condition_weight_units_options() { return array( @@ -537,6 +566,8 @@ function uc_order_condition_weight_units_options() { /** * Checks that the order is shippable. + * + * @see uc_order_rules_condition_info() */ function uc_order_condition_is_shippable($order, $settings) { return uc_order_is_shippable($order); @@ -545,7 +576,7 @@ function uc_order_condition_is_shippable($order, $settings) { /** * Updates an order's status. * - * @see uc_order_action_update_status_form() + * @see uc_order_rules_action_info() */ function uc_order_action_update_status($order, $status) { if (uc_order_update_status($order->order_id, $status)) { @@ -554,6 +585,11 @@ function uc_order_action_update_status($order, $status) { } /** + * Options callback. + * + * Lists all general and specific order statuses, indexed by ID. + * + * @see uc_order_rules_action_info() * @see uc_order_action_update_status() */ function uc_order_action_update_status_options() { @@ -572,7 +608,7 @@ function uc_order_action_update_status_options() { /** * Adds a comment to an order. * - * @see uc_order_action_add_comment_form() + * @see uc_order_rules_action_info() */ function uc_order_action_add_comment($order, $comment, $comment_type) { uc_order_comment_save($order->order_id, 0, @@ -582,6 +618,9 @@ function uc_order_action_add_comment($order, $comment, $comment_type) { } /** + * Options callback. + * + * @see uc_order_rules_action_info() * @see uc_order_action_add_comment() */ function uc_order_action_order_comment_types() { @@ -598,7 +637,7 @@ function uc_order_action_order_comment_types() { * The 'Sender', 'Recipients', 'Subject', and 'Message' fields accept * order token replacements. * - * @see uc_order_action_email_form() + * @see uc_order_rules_action_info() */ function uc_order_action_email($order, $from, $addresses, $subject, $message, $format) { $settings = array( @@ -642,7 +681,12 @@ function uc_order_action_email($order, $from, $addresses, $subject, $message, $f } /** + * Options callback. + * * Options list callback for message formats. + * + * @see uc_order_rules_action_info() + * @see uc_order_action_email() */ function uc_order_message_formats() { global $user; @@ -660,6 +704,8 @@ function uc_order_message_formats() { * Emails an invoice. * * The 'Sender', 'Subject' and 'Addresses' fields take order token replacements. + * + * @see uc_order_rules_action_info() */ function uc_order_action_email_invoice($order, $from, $addresses, $subject, $template, $view) { $settings = array( @@ -704,7 +750,12 @@ function uc_order_action_email_invoice($order, $from, $addresses, $subject, $tem } /** + * Options callback. + * + * List of levels of invoice detail. + * * @see uc_order_action_email_invoice() + * @see uc_order_rules_action_info() */ function uc_order_action_email_invoice_view_options() { return array(