diff --git a/uc_order/uc_order.rules.inc b/uc_order/uc_order.rules.inc index 62ac45d..f282c38 100644 --- a/uc_order/uc_order.rules.inc +++ b/uc_order/uc_order.rules.inc @@ -256,7 +256,7 @@ function uc_order_rules_condition_info() { ); $conditions['uc_order_condition_total'] = array( - 'label' => t('Check order total'), + 'label' => t("Check an order's total"), 'group' => t('Order'), 'base' => 'uc_order_condition_total', 'parameter' => array( @@ -281,7 +281,7 @@ function uc_order_rules_condition_info() { ); $conditions['uc_order_condition_subtotal'] = array( - 'label' => t('Check order subtotal'), + 'label' => t("Check an order's subtotal"), 'group' => t('Order'), 'base' => 'uc_order_condition_subtotal', 'parameter' => array( @@ -598,18 +598,7 @@ function uc_order_condition_count_products($order, $products, $count, $op) { } } } - switch ($op) { - case 'less': - return $total < $count; - case 'less_equal': - return $total <= $count; - case 'equal': - return $total == $count; - case 'greater_equal': - return $total >= $count; - case 'greater': - return $total > $count; - } + return uc_order_condition_value_operator_comparison($total, $op, $count); } /** @@ -658,18 +647,7 @@ function uc_order_condition_products_weight($order, $products, $weight_units, $w } } } - switch ($op) { - case 'less': - return $total < $weight_value; - case 'less_equal': - return $total <= $weight_value; - case 'equal': - return $total == $weight_value; - case 'greater_equal': - return $total >= $weight_value; - case 'greater': - return $total > $weight_value; - } + return uc_order_condition_value_operator_comparison($total, $op, $weight_value); } /** @@ -864,21 +842,21 @@ function uc_order_action_email_invoice_view_options() { } /** - * Value comparision. + * Value comparison. * * @param float $source * The source value. * @param string $op - * The comparision operator. + * The comparison operator. * @param float $target * The target value. * * @return bool - * Whether the comparision meets the specified conditions. + * Whether the comparison meets the specified conditions. * * @see uc_order_condition_value_operator_options */ -function uc_order_condition_value_operator_comparision($source, $op, $target) { +function uc_order_condition_value_operator_comparison($source, $op, $target) { switch ($op) { case 'less': return $source < $target; @@ -903,7 +881,7 @@ function uc_order_condition_value_operator_comparision($source, $op, $target) { * @param object $order * The order to check. * @param string $op - * The comparision operator. + * The comparison operator. * @param float $value * The target value. * @@ -913,7 +891,7 @@ function uc_order_condition_value_operator_comparision($source, $op, $target) { * @see uc_order_condition_value_operator_options */ function uc_order_condition_total($order, $op, $value) { - return uc_order_condition_value_operator_comparision($order->order_total, $op, $value); + return uc_order_condition_value_operator_comparison($order->order_total, $op, $value); } /** @@ -922,7 +900,7 @@ function uc_order_condition_total($order, $op, $value) { * @param object $order * The order to check. * @param string $op - * The comparision operator. + * The comparison operator. * @param float $value * The target value. * @@ -936,7 +914,7 @@ function uc_order_condition_subtotal($order, $op, $value) { foreach ($order->line_items as $line_item) { if ($line_item['type'] == 'subtotal') { $subtotal = $line_item['amount']; - return uc_order_condition_value_operator_comparision($subtotal, $op, $value); + return uc_order_condition_value_operator_comparison($subtotal, $op, $value); } } }