diff -dur ubercart.orig/ca/ca.admin.inc ubercart/ca/ca.admin.inc --- ubercart.orig/ca/ca.admin.inc 2010-03-13 10:22:26.000000000 -0800 +++ ubercart/ca/ca.admin.inc 2010-06-06 15:54:04.000000000 -0700 @@ -115,6 +115,7 @@ ksort($tables); // Add the tables for each trigger to the output. + $output = ''; foreach ($tables as $key => $value) { // Accommodate empty class names. if (empty($key)) { @@ -133,8 +134,10 @@ * Form to allow the creation and editing of conditional action predicates. */ function ca_predicate_meta_form($form_state, $pid) { + $form = array(); + // Load the predicate if an ID is passed in. - if (!empty($pid) && $pid !== 0) { + if (!empty($pid)) { $predicate = ca_load_predicate($pid); // Fail out if we didn't find a predicate for that ID. @@ -160,6 +163,7 @@ ); // Create an array of triggers for the select box. + $options = array(); $triggers = module_invoke_all('ca_trigger'); foreach ($triggers as $key => $value) { $options[$value['#category']][$key] = $value['#title']; @@ -183,7 +187,7 @@ ); // Accommodate the mandatory custom prefix for predicate classes. - $class = $predicate['#class']; + $class = $pid ? $predicate['#class'] : ''; if (strpos($class, 'custom') === 0) { $class = ltrim(substr($class, 6), ':'); } @@ -239,17 +243,21 @@ $save = FALSE; // Load the original predicate. - if ($form_state['values']['pid'] !== 0) { + if ($form_state['values']['predicate_pid']) { $predicate = ca_load_predicate($form_state['values']['predicate_pid']); + // in case the load fails, save the #pid in the array $predicate['#pid'] = $form_state['values']['predicate_pid']; } + else { + $predicate = array(); + } // Setup a list of fields to check for and apply changes. $fields = array('title', 'trigger', 'description', 'class', 'status', 'weight'); // Compare the values from the form submission with what is already set. foreach ($fields as $field) { - if ($form_state['values']['predicate_'. $field] != $predicate['#'. $field]) { + if (!isset($predicate['#'. $field]) || $form_state['values']['predicate_'. $field] != $predicate['#'. $field]) { $predicate['#'. $field] = $form_state['values']['predicate_'. $field]; $save = TRUE; } @@ -268,6 +276,12 @@ // Check to see if any changes were made and save if necessary. if ($save) { + if (!isset($predicate['#uid'])) { + $predicate['#uid'] = 0; + } + if (!isset($predicate['#condition'])) { + $predicate['#condition'] = NULL; + } ca_save_predicate($predicate); } @@ -278,6 +292,8 @@ * Form to reset a modified module defined predicate to its original state. */ function ca_predicate_delete_form($form_state, $pid) { + $form = array(); + $predicate = ca_load_predicate($pid); // Fail if we received an invalid predicate ID. @@ -353,6 +369,8 @@ // Load up any actions that could possibly be on this predicate. $action_data = ca_load_action(); + $form = array(); + $form['pid'] = array( '#type' => 'value', '#value' => $pid, @@ -370,13 +388,13 @@ foreach ($predicate['#actions'] as $key => $action) { // Add it to the form if the action's callback exists. - $callback = $action_data[$action['#name']]['#callback']; + $callback = !empty($action_data[$action['#name']]['#callback']) ? $action_data[$action['#name']]['#callback'] : NULL; if (function_exists($callback)) { $form['actions'][$i] = array( '#type' => 'fieldset', '#title' => t('Action: @title', array('@title' => $action_data[$action['#name']]['#title'])), - '#description' => $action_data[$action['#name']]['#description'], + '#description' => !empty($action_data[$action['#name']]['#description']) ? check_plain($action_data[$action['#name']]['#description']) : '', '#collapsible' => TRUE, '#collapsed' => isset($_SESSION['ca_action_focus']) && $i == $_SESSION['ca_action_focus'] ? FALSE : TRUE, ); @@ -416,7 +434,7 @@ '#type' => 'select', '#title' => check_plain($value['#title']), '#options' => $options, - '#default_value' => $action['#argument_map'][$key], + '#default_value' => isset($action['#argument_map'][$key]) ? $action['#argument_map'][$key] : NULL, ); } @@ -429,7 +447,8 @@ // Load the trigger data. $trigger_data = ca_load_trigger($predicate['#trigger']); - $form['actions'][$i]['settings'] = $callback(array(), $action['#settings'], $trigger_data['#arguments']); + $settings = isset($action['#settings']) ? $action['#settings'] : array(); + $form['actions'][$i]['settings'] = $callback(array(), $settings, $trigger_data['#arguments']); } $form['actions'][$i]['remove'] = array( @@ -537,7 +556,7 @@ $actions[] = array( '#name' => $value['name'], '#title' => $value['title'], - '#argument_map' => $value['argument_map'], + '#argument_map' => isset($value['argument_map']) ? $value['argument_map'] : NULL, '#settings' => empty($value['settings']) ? array() : $value['settings'], ); } @@ -583,6 +602,8 @@ // Initialize the conditions available for this predicate. ca_load_trigger_conditions($predicate['#trigger']); + $form = array(); + // Add the predicate ID to the form array. $form['pid'] = array( '#type' => 'value', @@ -738,7 +759,7 @@ $form[0] = array( '#type' => 'fieldset', '#title' => t('Condition: @title', array('@title' => $condition_data[$condition['#name']]['#title'])), - '#description' => t('@description', array('@description' => $condition_data[$condition['#name']]['#description'])), + '#description' => !empty($condition_data[$condition['#name']]['#description']) ? check_plain($condition_data[$condition['#name']]['#description']) : '', '#collapsible' => TRUE, '#collapsed' => isset($condition['#expanded']) ? FALSE : TRUE, ); @@ -803,9 +824,9 @@ $form['argument_map'][$key] = array( '#type' => 'select', - '#title' => check_plain($value['#title']), + '#title' => !empty($value['#title']) ? check_plain($value['#title']) : '', '#options' => $options, - '#default_value' => $condition['#argument_map'][$key], + '#default_value' => isset($condition['#argument_map'][$key]) ? $condition['#argument_map'][$key] : NULL, ); } @@ -816,7 +837,7 @@ '#type' => 'checkbox', '#title' => t('Negate this condition.'), '#description' => t('Return FALSE if the condition is TRUE and vice versa.'), - '#default_value' => $condition['#settings']['negate'], + '#default_value' => !empty($condition['#settings']['negate']), ); // Get the callback for the condition we're displaying. @@ -1012,23 +1033,23 @@ $group = 0; // Loop through each second level condition group. - foreach ($data['conditions'] as $key => $value) { + foreach ($data['conditions'] as $value) { // Save the operator setting. $conditions['#conditions'][$group]['#operator'] = $value['operator']; $conditions['#conditions'][$group]['#conditions'] = array(); // If conditions exist... - if (is_array($value['conditions']) && count($value['conditions']) > 0) { + if (!empty($value['conditions']) && is_array($value['conditions'])) { // Use a variable to track the condition array key as for groups. $condition = 0; // Loop through the conditions in this group. - foreach ($value['conditions'] as $cond_key => $cond_value) { + foreach ($value['conditions'] as $cond_value) { // Save the condition's settings. $conditions['#conditions'][$group]['#conditions'][$condition] = array( '#name' => $cond_value['name'], '#title' => $cond_value['title'], - '#argument_map' => $cond_value['argument_map'], + '#argument_map' => isset($cond_value['argument_map']) ? $cond_value['argument_map'] : NULL, '#settings' => $cond_value['settings'], ); @@ -1124,16 +1145,16 @@ switch ($configuration['#event']) { case 'order_status_update': $trigger = 'uc_order_status_update'; - break; + break; case 'payment_entered': $trigger = 'uc_payment_entered'; - break; + break; case 'checkout_complete': $trigger = 'uc_checkout_complete'; - break; + break; default: $trigger = $configuration['#event']; - break; + break; } // In UC 1.x, taxes had an event for each tax rate, using the same @@ -1145,8 +1166,8 @@ } $predicate['#trigger'] = $trigger; - $predicate['#weight'] = $configuration['#weight']; - $predicate['#status'] = $configuration['#active']; + $predicate['#weight'] = isset($configuration['#weight']) ? $configuration['#weight'] : 0; + $predicate['#status'] = isset($configuration['#active']) ? $configuration['#active'] : 0; // Numeric keys in $configuration could be for conditions or actions. // Take each and categorize them to add them to the predicate later. @@ -1219,7 +1240,7 @@ } } } - else if ($condition_tree['#type'] == 'condition') { + elseif ($condition_tree['#type'] == 'condition') { // Some conditions were renamed but check the same things. switch ($condition_tree['#name']) { case 'uc_order_condition_order_total': diff -dur ubercart.orig/ca/ca.ca.inc ubercart/ca/ca.ca.inc --- ubercart.orig/ca/ca.ca.inc 2009-07-21 07:37:19.000000000 -0700 +++ ubercart/ca/ca.ca.inc 2010-06-06 13:44:42.000000000 -0700 @@ -94,6 +94,8 @@ * and their data types. */ function ca_ca_action() { + $actions = array(); + $actions['ca_drupal_set_message'] = array( '#title' => t('Display a message to the user'), '#category' => t('Drupal'), @@ -150,14 +152,14 @@ 'only' => t('Only'), 'after' => t('After'), ), - '#default_value' => $settings['operator'], + '#default_value' => empty($settings['operator']) ? 'only' : $settings['operator'], '#description' => t('Example: "The current date is before the date below."'), ); $form['date'] = array( '#type' => 'date', '#title' => t('Date'), - '#default_value' => $settings['date'], + '#default_value' => empty($settings['date']) ? NULL /* = time() */ : $settings['date'], '#description' => t('When the predicate is evaluated, the current date is compared to this date.'), ); @@ -170,6 +172,10 @@ * @see ca_condition_node_field_comparison_form() */ function ca_condition_node_field_comparison($node, $settings) { + if (empty($settings['operator']) || empty($settings['value'])) { + return FALSE; + } + // Convert the node to an array. $node_array = (array) $node; @@ -349,7 +355,7 @@ $form['message_text'] = array( '#type' => 'textarea', '#title' => t('Message text'), - '#default_value' => $settings['message_text'], + '#default_value' => isset($settings['message_text']) ? $settings['message_text'] : '', ); $tips = _filter_tips(variable_get('filter_default_format', 1), FALSE); @@ -384,6 +390,8 @@ * @see ca_condition_custom_php() */ function ca_condition_custom_php_form($form_state, $settings = array(), $arguments = array()) { + $form = array(); + $form['variables'] = _ca_custom_php_variables_table($arguments); $form['php'] = array( @@ -426,6 +437,8 @@ * @see ca_condition_user_roles() */ function ca_condition_user_roles_form($form_state, $settings = array()) { + $form = array(); + $form['operator'] = array( '#type' => 'radios', '#title' => t('Operator'), @@ -459,12 +472,14 @@ * @see ca_action_custom_php() */ function ca_action_custom_php_form($form_state, $settings = array(), $arguments = array()) { + $form = array(); + $form['variables'] = _ca_custom_php_variables_table($arguments); $form['php'] = array( '#type' => 'textarea', '#title' => t('Custom PHP'), - '#description' => t('Enter the custom PHP to be evaluated when this action is executed. Should not include <?php ?> delimiters.'), + '#description' => t('Enter the custom PHP to be evaluated when this action is executed. Should not include <?php ?> delimiters.'), '#default_value' => isset($settings['php']) ? $settings['php'] : '', ); diff -dur ubercart.orig/ca/ca.install ubercart/ca/ca.install --- ubercart.orig/ca/ca.install 2009-07-21 07:37:19.000000000 -0700 +++ ubercart/ca/ca.install 2010-06-02 23:26:33.000000000 -0700 @@ -18,7 +18,7 @@ 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, - 'default' => '', + //'default' => '', -- primary keys should never have a default ), 'title' => array( 'type' => 'varchar', diff -dur ubercart.orig/ca/ca.module ubercart/ca/ca.module --- ubercart.orig/ca/ca.module 2009-11-11 13:06:48.000000000 -0800 +++ ubercart/ca/ca.module 2010-06-06 14:36:14.000000000 -0700 @@ -220,6 +220,7 @@ $entities = module_invoke_all('ca_entity'); // Loop through the expected arguments. + $arguments = array(); foreach ($trigger['#arguments'] as $key => $value) { // Grab for comparison the next argument passed to the trigger. $arg = array_shift($args); @@ -259,12 +260,7 @@ // inactive predicates if $all == FALSE and adds a default weight if need be. foreach ($predicates as $key => $value) { // Unset the predicate if it doesn't use the specified trigger. - if ($value['#trigger'] != $trigger) { - unset($predicates[$key]); - continue; - } - - if (!$all && $value['#status'] <= 0) { + if ($value['#trigger'] != $trigger || (!$all && $value['#status'] <= 0)) { unset($predicates[$key]); } elseif (!isset($value['#weight'])) { @@ -438,7 +434,7 @@ $result = call_user_func_array($callback, $args); // If the negate operator is TRUE, then switch the result! - if ($condition['#settings']['negate']) { + if (!empty($condition['#settings']['negate'])) { $result = !$result; } @@ -485,7 +481,7 @@ if (isset($action['#argument_map'][$key])) { // Adding the arguments as references so action functions can update the // arguments here when they make changes to the argument data. - if ($value['#entity'] == 'arguments') { + if (!empty($value['#entity']) && $value['#entity'] == 'arguments') { $args[] = &$arguments; } else { @@ -499,7 +495,7 @@ } // Add the condition settings to the argument list. - $args[] = is_array($action['#settings']) ? $action['#settings'] : array(); + $args[] = empty($action['#settings']) ? array() : $action['#settings']; // Call the action's function with the appropriate arguments. $results[$i] = call_user_func_array($callback, $args); @@ -641,7 +637,7 @@ $entity = $argument['#entity']; // If the condition requires an entity the trigger doesn't provide, // then skip to the next condition. - if ($entity != 'arguments' && !$trigger_entities[$entity]) { + if ($entity != 'arguments' && empty($trigger_entities[$entity])) { continue 2; } } @@ -726,7 +722,7 @@ $entity = $argument['#entity']; // If the action requires an entity the trigger doesn't provide, // then skip to the next action. - if ($entity != 'arguments' && !$trigger_entities[$entity]) { + if ($entity != 'arguments' && empty($trigger_entities[$entity])) { continue 2; } } @@ -968,6 +964,15 @@ if (!empty($predicates[$pid])) { $predicate = $predicates[$pid]; + + // many module define predicates without all the expected fields + $predicate += array( + '#description' => NULL, + '#weight' => 0, + '#uid' => 0, + '#conditions' => NULL, + '#actions' => NULL, + ); } } diff -dur ubercart.orig/payment/uc_credit/uc_credit.module ubercart/payment/uc_credit/uc_credit.module --- ubercart.orig/payment/uc_credit/uc_credit.module 2010-03-10 21:41:22.000000000 -0800 +++ ubercart/payment/uc_credit/uc_credit.module 2010-05-31 23:38:18.000000000 -0700 @@ -138,13 +138,15 @@ } // Cache the CC details for use in other functions. - uc_credit_cache('save', $_SESSION['sescrd']); + if (isset($_SESSION['sescrd'])) { + uc_credit_cache('save', $_SESSION['sescrd']); - // Store the encrypted details to the form for processing on submit. - $form['sescrd'] = array( - '#type' => 'hidden', - '#value' => base64_encode($_SESSION['sescrd']), - ); + // Store the encrypted details to the form for processing on submit. + $form['sescrd'] = array( + '#type' => 'hidden', + '#value' => base64_encode($_SESSION['sescrd']), + ); + } // Add submit handler to preserve CC details for the back button and // failed order submissions. @@ -228,14 +230,21 @@ /** * Implementation of hook_exit(). + * + * Make sure sensitive checkout session data doesn't persist on other pages. */ function uc_credit_exit() { - // Separate the args ourself since the arg() function may not be loaded. - $args = explode('/', $_GET['q']); - - // Make sure sensitive checkout session data doesn't persist on other pages. - if (isset($_SESSION['sescrd']) && (!isset($args[1]) || $args[1] != 'checkout')) { - unset($_SESSION['sescrd']); + if (isset($_SESSION['sescrd'])) { + if (isset($_GET['q'])) { + // Separate the args ourself since the arg() function may not be loaded. + $args = explode('/', $_GET['q']); + if (!isset($args[1]) || $args[1] != 'checkout') { + unset($_SESSION['sescrd']); + } + } + else { + unset($_SESSION['sescrd']); + } } } @@ -550,6 +559,8 @@ return $review; case 'order-view': + $output = ''; + // Add the hidden span for the CC details if possible. if (user_access('view cc details')) { drupal_add_js(drupal_get_path('module', 'uc_credit') .'/uc_credit.js'); diff -dur ubercart.orig/payment/uc_payment/uc_payment.ca.inc ubercart/payment/uc_payment/uc_payment.ca.inc --- ubercart.orig/payment/uc_payment/uc_payment.ca.inc 2009-08-17 14:27:55.000000000 -0700 +++ ubercart/payment/uc_payment/uc_payment.ca.inc 2010-06-03 04:57:59.000000000 -0700 @@ -218,7 +218,7 @@ '#type' => 'radios', '#title' => t('Payment method'), '#options' => $options, - '#default_value' => $settings['payment_method'], + '#default_value' => isset($settings['payment_method']) ? $settings['payment_method'] : NULL, ); return $form; diff -dur ubercart.orig/payment/uc_payment/uc_payment.module ubercart/payment/uc_payment/uc_payment.module --- ubercart.orig/payment/uc_payment/uc_payment.module 2010-01-27 14:23:31.000000000 -0800 +++ ubercart/payment/uc_payment/uc_payment.module 2010-05-31 17:00:29.000000000 -0700 @@ -147,10 +147,8 @@ 'type' => 'amount', ); $values['order-payment-balance'] = uc_price(uc_payment_balance($order), $context); - break; + return $values; } - - return $values; } /** @@ -160,9 +158,8 @@ if ($type == 'order' || $type == 'ubercart' || $type == 'all') { $tokens['order']['order-payment-method'] = t('The payment method of the order.'); $tokens['order']['order-payment-balance'] = t('The payment balance of the order'); + return $tokens; } - - return $tokens; } /** @@ -737,7 +734,7 @@ $methods = _payment_method_list(); foreach ($methods as $method) { if ($method['id'] == $method_id) { - return $method[$key]; + return isset($method[$key]) ? $method[$key] : NULL; } } } diff -dur ubercart.orig/shipping/uc_quote/uc_quote.module ubercart/shipping/uc_quote/uc_quote.module --- ubercart.orig/shipping/uc_quote/uc_quote.module 2010-02-23 10:36:53.000000000 -0800 +++ ubercart/shipping/uc_quote/uc_quote.module 2010-06-06 16:18:25.000000000 -0700 @@ -323,7 +323,7 @@ $form['type'] = array('#type' => 'select', '#title' => t('Shipping type'), '#options' => $options, - '#default_value' => $settings['type'], + '#default_value' => isset($settings['type']) ? $settings['type'] : NULL, ); return $form; @@ -365,7 +365,7 @@ $options = array(); foreach ($methods as $id => $method) { $options[$id] = $method['title']; - if (!$enabled[$id]) { + if (empty($enabled[$id])) { $options[$id] .= ' '. t('(disabled)'); } } @@ -373,7 +373,7 @@ $form['method'] = array( '#type' => 'select', '#title' => t('Shipping quote method'), - '#default_value' => $settings['method'], + '#default_value' => isset($settings['method']) ? $settings['method'] : NULL, '#options' => $options, ); diff -dur ubercart.orig/shipping/uc_ups/uc_ups.module ubercart/shipping/uc_ups/uc_ups.module --- ubercart.orig/shipping/uc_ups/uc_ups.module 2010-02-08 07:29:30.000000000 -0800 +++ ubercart/shipping/uc_ups/uc_ups.module 2010-06-06 16:00:27.000000000 -0700 @@ -71,6 +71,26 @@ } /** + * Get the quote enabled settings. + */ +function uc_ups_get_quote_enabled() { + return variable_get('uc_quote_enabled', array()) + + array( + 'ups' => 0, + ); +} + +/** + * Get the quote method weight. + */ +function uc_ups_get_quote_method_weight() { + return variable_get('uc_quote_method_weight', array()) + + array( + 'ups' => 0 + ); +} + +/** * Implementation of hook_form_alter(). * * Add package type to products. @@ -81,8 +101,8 @@ function uc_ups_form_alter(&$form, $form_state, $form_id) { if (uc_product_is_product_form($form)) { $node = $form['#node']; - $enabled = variable_get('uc_quote_enabled', array()); - $weight = variable_get('uc_quote_method_weight', array('ups' => 0)); + $enabled = uc_ups_get_quote_enabled(); + $weight = uc_ups_get_quote_method_weight(); $ups = array( '#type' => 'fieldset', '#title' => t('UPS product description'), @@ -110,7 +130,6 @@ * @see uc_ups_form_alter() */ function uc_ups_product_alter_validate($form, &$form_state) { - $enabled = variable_get('uc_quote_enabled', array()); if ($form_state['values']['shippable'] && ($form_state['values']['shipping_type'] == 'small_package' || (empty($form_state['values']['shipping_type']) && variable_get('uc_store_shipping_type', 'small_package') == 'small_package'))) { if ($form_state['values']['ups']['pkg_type'] == '02' && (empty($form_state['values']['dim_length']) || empty($form_state['values']['dim_width']) || empty($form_state['values']['dim_height']))) { form_set_error('base][dimensions', t('Dimensions are required for custom packaging.')); @@ -160,7 +179,7 @@ * Connect the UPS quote action and event. */ function uc_ups_ca_predicate() { - $enabled = variable_get('uc_quote_enabled', array()); + $enabled = uc_ups_get_quote_enabled(); $predicates = array( 'uc_ups_get_quote' => array( @@ -210,8 +229,8 @@ function uc_ups_shipping_method() { $methods = array(); - $enabled = variable_get('uc_quote_enabled', array()); - $weight = variable_get('uc_quote_method_weight', array('ups' => 0)); + $enabled = uc_ups_get_quote_enabled(); + $weight = uc_ups_get_quote_method_weight(); $methods['ups'] = array( 'id' => 'ups', 'module' => 'uc_ups', diff -dur ubercart.orig/shipping/uc_usps/uc_usps.module ubercart/shipping/uc_usps/uc_usps.module --- ubercart.orig/shipping/uc_usps/uc_usps.module 2010-02-08 08:31:28.000000000 -0800 +++ ubercart/shipping/uc_usps/uc_usps.module 2010-06-06 15:41:50.000000000 -0700 @@ -41,6 +41,32 @@ } /** + * Get the quote enabled settings. + */ +function uc_usps_get_quote_enabled() { + return variable_get('uc_quote_enabled', array()) + + array( + 'usps' => 0, + 'usps_env' => 0, + 'usps_intl' => 0, + 'usps_intl_env' => 0, + ); +} + +/** + * Get the quote method weight. + */ +function uc_usps_get_quote_method_weight() { + return variable_get('uc_quote_method_weight', array()) + + array( + 'usps' => 0, + 'usps_env' => 0, + 'usps_intl' => 1, + 'usps_intl_env' => 1, + ); +} + +/** * Implementation of hook_form_alter(). * * Add package type to products. @@ -50,8 +76,8 @@ function uc_usps_form_alter(&$form, $form_state, $form_id) { if (uc_product_is_product_form($form)) { $node = $form['#node']; - $enabled = variable_get('uc_quote_enabled', array()); - $weight = variable_get('uc_quote_method_weight', array('usps' => 0, 'usps_intl' => 1)); + $enabled = uc_usps_get_quote_enabled(); + $weight = uc_usps_get_quote_method_weight(); $form['shipping']['usps'] = array( '#type' => 'fieldset', '#title' => t('USPS product description'), @@ -111,7 +137,7 @@ * Connect USPS quote action and event. */ function uc_usps_ca_predicate() { - $enabled = variable_get('uc_quote_enabled', array()); + $enabled = uc_usps_get_quote_enabled(); $quote_action = array( '#name' => 'uc_quote_action_get_quote', '#title' => t('Fetch a shipping quote'), @@ -256,13 +282,8 @@ * Implementation of hook_shipping_method(). */ function uc_usps_shipping_method() { - $enabled = variable_get('uc_quote_enabled', array()); - $weight = variable_get('uc_quote_method_weight', array( - 'usps_env' => 0, - 'usps' => 0, - 'usps_intl_env' => 1, - 'usps_intl' => 1, - )); + $enabled = uc_usps_get_quote_enabled(); + $weight = uc_usps_get_quote_method_weight(); $methods = array( 'usps_env' => array( diff -dur ubercart.orig/uc_attribute/uc_attribute.ca.inc ubercart/uc_attribute/uc_attribute.ca.inc --- ubercart.orig/uc_attribute/uc_attribute.ca.inc 2009-07-21 07:37:21.000000000 -0700 +++ ubercart/uc_attribute/uc_attribute.ca.inc 2010-06-06 16:29:01.000000000 -0700 @@ -85,7 +85,7 @@ $form['attribute_option'] = array( '#type' => 'select', '#title' => t('Attribute option'), - '#default_value' => $settings['attribute_option'], + '#default_value' => isset($settings['attribute_option']) ? $settings['attribute_option'] : NULL, '#options' => $options, ); diff -dur ubercart.orig/uc_cart/uc_cart.ca.inc ubercart/uc_cart/uc_cart.ca.inc --- ubercart.orig/uc_cart/uc_cart.ca.inc 2009-07-21 07:37:20.000000000 -0700 +++ ubercart/uc_cart/uc_cart.ca.inc 2010-06-04 03:45:55.000000000 -0700 @@ -154,7 +154,7 @@ $form['class'] = array('#type' => 'select', '#title' => t('Product class'), '#options' => uc_product_type_names(), - '#default_value' => $settings['class'], + '#default_value' => isset($settings['class']) ? $settings['class'] : NULL, ); return $form; diff -dur ubercart.orig/uc_cart/uc_cart_checkout_pane.inc ubercart/uc_cart/uc_cart_checkout_pane.inc --- ubercart.orig/uc_cart/uc_cart_checkout_pane.inc 2010-01-22 13:40:22.000000000 -0800 +++ ubercart/uc_cart/uc_cart_checkout_pane.inc 2010-05-31 20:45:00.000000000 -0700 @@ -448,6 +451,9 @@ if (isset($form['copy_address'])) { $output = drupal_render($form['copy_address']); } + else { + $output = ''; + } $output .= '
|
diff -dur ubercart.orig/uc_order/uc_order.admin.inc ubercart/uc_order/uc_order.admin.inc --- ubercart.orig/uc_order/uc_order.admin.inc 2010-04-12 20:44:36.000000000 -0700 +++ ubercart/uc_order/uc_order.admin.inc 2010-05-31 16:50:02.000000000 -0700 @@ -1078,6 +1078,7 @@ exit(); } + $output = ''; $panes = _order_pane_list($view); foreach ($panes as $pane) { if (in_array($view, $pane['show']) && @@ -1155,13 +1156,14 @@ * @see uc_order_edit_form() */ function theme_uc_order_edit_form($form) { + $output = ''; $panes = _order_pane_list(); foreach ($panes as $pane) { if (in_array('edit', $pane['show']) && variable_get('uc_order_pane_'. $pane['id'] .'_show_edit', TRUE)) { $func = $pane['callback']; if (function_exists($func) && ($contents = _call_order_pane_byref($func, 'edit-theme', $form)) != NULL) { - if (is_array($pane['theme_all']) && in_array('edit', $pane['theme_all'])) { + if (isset($pane['theme_all']) && is_array($pane['theme_all']) && in_array('edit', $pane['theme_all'])) { $output .= $contents; } else { diff -dur ubercart.orig/uc_order/uc_order.ca.inc ubercart/uc_order/uc_order.ca.inc --- ubercart.orig/uc_order/uc_order.ca.inc 2009-10-20 13:58:07.000000000 -0700 +++ ubercart/uc_order/uc_order.ca.inc 2010-06-06 02:16:55.000000000 -0700 @@ -362,7 +362,7 @@ '#type' => 'select', '#title' => t('Order status'), '#options' => $options, - '#default_value' => $settings['order_status'], + '#default_value' => isset($settings['order_status']) ? $settings['order_status'] : NULL, ); return $form; @@ -396,7 +396,7 @@ '#type' => 'textfield', '#title' => t('Order total value'), '#description' => t('Specify a value to compare the order total against.'), - '#default_value' => $settings['order_total_value'], + '#default_value' => isset($settings['order_total_value']) ? $settings['order_total_value'] : NULL, '#size' => 16, '#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'), '#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '', @@ -439,7 +439,7 @@ $form['pattern'] = array( '#type' => 'textfield', '#title' => uc_get_field_name('postal_code'), - '#default_value' => $settings['pattern'], + '#default_value' => isset($settings['pattern']) ? $settings['pattern'] : NULL, '#description' => t('Specify a postal code or postal code pattern. Use "*" as a wild card to specify a range of postal codes. Example: In the US, 402* represents all areas from 40200 to 40299.'), '#size' => 15, // '#required' => TRUE, @@ -470,7 +470,7 @@ '#type' => 'select', '#title' => uc_get_field_name('zone'), '#options' => $options, - '#default_value' => $settings['zones'], + '#default_value' => isset($settings['zones']) ? $settings['zones'] : NULL, '#multiple' => TRUE, // '#required' => TRUE, ); @@ -492,7 +492,7 @@ */ function uc_order_condition_delivery_country_form($form_state, $settings = array()) { $form['countries'] = uc_country_select(uc_get_field_name('country')); - $form['countries']['#default_value'] = $settings['countries']; + $form['countries']['#default_value'] = isset($settings['countries']) ? $settings['countries'] : NULL; $form['countries']['#multiple'] = TRUE; // $form['countries']['#required'] = TRUE; @@ -519,7 +519,7 @@ $form['pattern'] = array( '#type' => 'textfield', '#title' => uc_get_field_name('postal_code'), - '#default_value' => $settings['pattern'], + '#default_value' => isset($settings['pattern']) ? $settings['pattern'] : '', '#description' => t('Specify a postal code or postal code pattern. Use "*" as a wild card to specify a range of postal codes. Example: In the US, 402* represents all areas from 40200 to 40299.'), '#size' => 15, // '#required' => TRUE, @@ -550,7 +550,7 @@ '#type' => 'select', '#title' => uc_get_field_name('zone'), '#options' => $options, - '#default_value' => $settings['zones'], + '#default_value' => isset($settings['zones']) ? $settings['zones'] : NULL, '#multiple' => TRUE, // '#required' => TRUE, ); @@ -572,7 +572,7 @@ */ function uc_order_condition_billing_country_form($form_state, $settings = array()) { $form['countries'] = uc_country_select(uc_get_field_name('country')); - $form['countries']['#default_value'] = $settings['countries']; + $form['countries']['#default_value'] = isset($settings['countries']) ? $settings['countries'] : ''; $form['countries']['#multiple'] = TRUE; // $form['countries']['#required'] = TRUE; @@ -636,7 +636,7 @@ $form['products'] = array('#type' => 'select', '#title' => t('Product models'), '#options' => $options, - '#default_value' => $settings['products'], + '#default_value' => isset($settings['products']) ? $settings['products'] : '', '#multiple' => TRUE, ); return $form; @@ -688,7 +688,7 @@ $form['products'] = array('#type' => 'select', '#title' => t('Products'), '#options' => $options, - '#default_value' => $settings['products'], + '#default_value' => isset($settings['products']) ? $settings['products'] : NULL, '#description' => check_plain(t('Selecting "- All products -" will override any other selections and returns the total number of products in the order.')), '#multiple' => TRUE, ); @@ -696,7 +696,7 @@ '#type' => 'textfield', '#title' => t('Product count value'), '#description' => t('Specify a value to compare the product count against.'), - '#default_value' => $settings['product_count_value'], + '#default_value' => isset($settings['product_count_value']) ? $settings['product_count_value'] : '', '#size' => 16, ); @@ -764,13 +764,13 @@ $form['products'] = array('#type' => 'select', '#title' => t('Products'), '#options' => $options, - '#default_value' => $settings['products'], + '#default_value' => isset($settings['products']) ? $settings['products'] : NULL, '#description' => check_plain(t('Selecting "- All products -" will override any other selections and returns the total number of products in the order.')), '#multiple' => TRUE, ); $form['weight_units'] = array('#type' => 'select', '#title' => t('Unit of measurement'), - '#default_value' => $settings['weight_units'] ? $settings['weight_units'] : variable_get('uc_weight_unit', 'lb'), + '#default_value' => !empty($settings['weight_units']) ? $settings['weight_units'] : variable_get('uc_weight_unit', 'lb'), '#options' => array( 'lb' => t('Pounds'), 'kg' => t('Kilograms'), @@ -782,7 +782,7 @@ '#type' => 'textfield', '#title' => t('Product weight value'), '#description' => t('Specify a value to compare the product weight against.'), - '#default_value' => $settings['product_weight_value'], + '#default_value' => isset($settings['product_weight_value']) ? $settings['product_weight_value'] : '', '#size' => 16, ); @@ -1088,7 +1088,7 @@ '#type' => 'select', '#title' => t('Order status'), '#options' => $options, - '#default_value' => $settings['order_status'], + '#default_value' => isset($settings['order_status']) ? $settings['order_status'] : NULL, ); return $form; @@ -1118,13 +1118,13 @@ 'order' => t('Enter this as a customer order comment.'), 'notified' => t('Enter this as a customer order comment with a notified icon.'), ), - '#default_value' => $settings['comment_type'], + '#default_value' => isset($settings['comment_type']) ? $settings['comment_type'] : 'admin', ); $form['comment'] = array( '#type' => 'textarea', '#title' => t('Comment'), '#description' => t('Enter the comment message. Uses order and global tokens.', array('!url' => url('admin/store/help/tokens'))), - '#default_value' => $settings['comment'], + '#default_value' => isset($settings['comment']) ? $settings['comment'] : '', ); return $form; @@ -1183,17 +1183,17 @@ $form['subject'] = array( '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => $settings['subject'], + '#default_value' => isset($settings['subject']) ? $settings['subject'] : 'Order #[order-id] from [store-name]', '#required' => TRUE, ); $form['message'] = array( '#type' => 'textarea', '#title' => t('Message'), - '#default_value' => $settings['message'], + '#default_value' => isset($settings['message']) ? $settings['message'] : '', ); // We add the #is_format element to allow us to locate and configure the filters. - $form['format'] = filter_form($settings['format']) + array('#is_format' => TRUE); + $form['format'] = filter_form(isset($settings['format']) ? $settings['format'] : NULL) + array('#is_format' => TRUE); $form['token_help'] = array( '#type' => 'fieldset', @@ -1275,7 +1275,7 @@ $form['subject'] = array( '#type' => 'textfield', '#title' => t('Subject'), - '#default_value' => $settings['subject'], + '#default_value' => isset($settings['subject']) ? $settings['subject'] : t('Order #[order-id] from [store-name]'), '#required' => TRUE, ); @@ -1307,7 +1307,7 @@ '#title' => t('Invoice template'), '#description' => t('Select the invoice template to use for this email.'), '#options' => uc_order_template_options(), - '#default_value' => $settings['template'], + '#default_value' => isset($settings['template']) ? $settings['template'] : NULL, ); $form['view'] = array( '#type' => 'radios', @@ -1317,7 +1317,7 @@ 'admin-mail' => t('Show all of the above plus the help text, email text, and store footer.'), 'checkout-mail' => t('Show all of the above plus the "thank you" message.'), ), - '#default_value' => $settings['view'], + '#default_value' => isset($settings['view']) ? $settings['view'] : 'print', ); return $form; diff -dur ubercart.orig/uc_order/uc_order.module ubercart/uc_order/uc_order.module --- ubercart.orig/uc_order/uc_order.module 2010-03-17 20:09:41.000000000 -0700 +++ ubercart/uc_order/uc_order.module 2010-05-31 16:51:41.000000000 -0700 @@ -395,7 +395,7 @@ $values['order-email'] = check_plain($order->primary_email); $values['order-shipping-address'] = uc_order_address($order, 'delivery'); $values['order-shipping-phone'] = check_plain($order->delivery_phone); - $values['order-shipping-method'] = is_null($ship_method) ? t('Standard delivery') : $ship_method; + $values['order-shipping-method'] = empty($ship_method) ? t('Standard delivery') : $ship_method; $values['order-billing-address'] = uc_order_address($order, 'billing'); $values['order-billing-phone'] = check_plain($order->billing_phone); if (variable_get('uc_customer_list_address', 'billing') == 'shipping') { @@ -1175,6 +1175,9 @@ if (!$admin) { $join = " LEFT JOIN {uc_order_statuses} AS os ON oc.order_status = os.order_status_id"; } + else { + $join = ""; + } $result = db_query("SELECT * FROM {". (($admin) ? 'uc_order_admin_comments' : 'uc_order_comments') ."} AS oc". $join ." WHERE oc.order_id = %d ORDER BY oc.created, oc.comment_id", $order_id); while ($comment = db_fetch_object($result)) { $comments[] = $comment; @@ -1243,7 +1246,7 @@ 'title' => $line['title'], 'amount' => $line['amount'], 'weight' => isset($line['weight']) ? $line['weight'] : $type['weight'], - 'data' => $line['data'], + 'data' => isset($line['data']) ? $line['data'] : NULL, ); } } @@ -1565,7 +1568,7 @@ 'title' => $line['title'], 'amount' => $line['amount'], 'weight' => $item['weight'], - 'data' => $item['data'], + 'data' => isset($item['data']) ? $item['data'] : NULL, ); } } @@ -1857,6 +1860,7 @@ } if ($icon_html) { + $output = ''; foreach ($actions as $action) { $output .= l($action['icon'], $action['url'], array('attributes' => array('title' => $action['title']), 'html' => TRUE)); } diff -dur ubercart.orig/uc_order/uc_order.order_pane.inc ubercart/uc_order/uc_order.order_pane.inc --- ubercart.orig/uc_order/uc_order.order_pane.inc 2010-01-04 07:15:07.000000000 -0800 +++ ubercart/uc_order/uc_order.order_pane.inc 2010-05-31 17:03:44.000000000 -0700 @@ -70,7 +70,7 @@ return $form; case 'edit-title': - $output .= ' |