=== modified file 'uc_order/images/false-icon.gif' (properties changed: -x to +x) === modified file 'uc_order/images/order_delete.png' (properties changed: -x to +x) === modified file 'uc_order/images/order_edit.png' (properties changed: -x to +x) === modified file 'uc_order/images/order_view.png' (properties changed: -x to +x) === modified file 'uc_order/images/true-icon.gif' (properties changed: -x to +x) === modified file 'uc_order/templates/admin.itpl.php' (properties changed: -x to +x) === modified file 'uc_order/templates/customer.itpl.php' (properties changed: -x to +x) --- uc_order/templates/customer.itpl.php 2009-06-17 19:43:20 +0000 +++ uc_order/templates/customer.itpl.php 2009-06-29 23:28:48 +0000 @@ -247,7 +247,7 @@ - +

=== modified file 'uc_order/translations/uc_order.pot' (properties changed: -x to +x) === modified file 'uc_order/uc_order.admin.inc' (properties changed: -x to +x) --- uc_order/uc_order.admin.inc 2009-06-23 14:09:18 +0000 +++ uc_order/uc_order.admin.inc 2009-07-01 14:30:20 +0000 @@ -24,6 +24,7 @@ * Generate the settings form for orders. */ function uc_order_settings_form() { + $form = array(); $form['admin'] = array( '#type' => 'fieldset', @@ -118,7 +119,8 @@ * order statuses. */ function _uc_order_states_summarize($form, $states) { - $statuses = $items = array(); + $statuses = array(); + $items = array(); foreach ($states as $state) { $items[] = t('@state', array('@state' => $state['title'])); @@ -134,6 +136,8 @@ // Display the order workflow form for order state and status customization. function uc_order_workflow_form() { + $form = array(); + $options = array(); $states = uc_order_state_list(); $statuses = uc_order_status_list(); @@ -186,7 +190,6 @@ ); // Build the state option array for the order status table. - $options = array(); foreach ($states as $state) { $options[$state['id']] = $state['title']; } @@ -254,8 +257,8 @@ else { if ($value['locked'] == TRUE) { db_query("UPDATE {uc_order_statuses} SET title = '%s', weight = %d " - ."WHERE order_status_id = '%s'", $value['title'], - $value['weight'], $key); + ."WHERE order_status_id = '%s'", $value['title'], + $value['weight'], $key); } else { db_query("UPDATE {uc_order_statuses} SET title = '%s', state = '%s', " @@ -275,6 +278,7 @@ } function uc_order_panes_form() { + $form = array(); $panes = _order_pane_list(); foreach ($panes as $pane) { @@ -324,6 +328,25 @@ // Present the form to create a custom order status. function uc_order_status_create_form() { + $form = array(); + $options = array(); + + // Build the state option array for the order status table. + + $uc_order_state_list = uc_order_state_list(); //moved for efficencey + foreach ($$uc_order_state_list as $state) { + $options[$state['id']] = $state['title']; + } + + $form['status_state'] = array( + '#type' => 'select', + '#title' => t('Order state'), + '#description' => t('Set which order state this status is for.'), + '#summary callback' => 'summarize_null', + '#options' => $options, + '#default_value' => 'post_checkout', + ); + $form['status_id'] = array( '#type' => 'textfield', '#title' => t('Order status ID'), @@ -344,20 +367,6 @@ '#required' => TRUE, ); - // Build the state option array for the order status table. - $options = array(); - foreach (uc_order_state_list() as $state) { - $options[$state['id']] = $state['title']; - } - $form['status_state'] = array( - '#type' => 'select', - '#title' => t('Order state'), - '#description' => t('Set which order state this status is for.'), - '#summary callback' => 'summarize_null', - '#options' => $options, - '#default_value' => 'post_checkout', - ); - $form['status_weight'] = array( '#type' => 'weight', '#title' => t('List position'), @@ -405,6 +414,8 @@ * Display the main order admin screen, an overview of all received orders. */ function uc_order_admin($sql = NULL, $args = NULL, $search = FALSE) { + $where = ""; + $rows = array(); $header = array( array('data' => t('Actions')), array('data' => t('Order ID'), 'field' => 'o.order_id', 'sort' => 'desc'), @@ -432,9 +443,7 @@ $where = 'WHERE o.order_status IN '. uc_order_status_list('general', TRUE); } } - if ($_SESSION['sort_status'] == 'all') { - $where = ''; - } + $sql = 'SELECT o.order_id, o.uid, o.billing_first_name, o.billing_last_name, o.order_total, ' .'o.order_status, o.created, os.title FROM {uc_orders} o LEFT JOIN {uc_order_statuses} os ' .'ON o.order_status = os.order_status_id '. $where . tablesort_sql($header); @@ -553,6 +562,8 @@ * Create the textfield box to select an order by ID on the order overview screen. */ function uc_order_select_form() { + $form = array(); + $form['order_id'] = array( '#type' => 'textfield', '#title' => t('View order'), @@ -604,6 +615,8 @@ } function uc_order_create_form() { + $form = array(); + $form['customer'] = array( '#type' => 'fieldset', '#title' => t('New order customer'), @@ -712,15 +725,16 @@ } function uc_order_address_book() { - $uid = intval($_POST['uid']); - $type = $_POST['type']; - $func = $_POST['func']; + $uid = isset($_POST['uid']) ? intval($_POST['uid']) : NULl; + $type = isset($_POST['type']) ? $_POST['type'] : NULL; + $func = isset($_POST['func']) ? $_POST['func'] : NULL; print drupal_get_form('uc_order_address_book_form', $uid, $type, $func); exit(); } function uc_order_address_book_form($form_state, $uid = 0, $type = 'billing', $func = '') { + $form = array(); $select = uc_select_address($uid, $type, $func); if ($uid == 0) { @@ -746,7 +760,9 @@ function uc_order_select_customer($email = NULL) { $options = NULL; - + $where = ''; + $output = ''; + // Return the search results and let them pick one! if (arg(4) == 'search') { $first_name = strtolower(str_replace('*', '%', check_plain(arg(5)))); @@ -841,6 +857,8 @@ } function uc_order_select_customer_form($form_state, $options = NULL) { + $form = array(); + if (is_null(arg(4))) { $form['desc'] = array( '#value' => '
'. t('Search for a customer based on these fields.') @@ -981,6 +999,8 @@ * Display the order view screen, constructed via hook_order_pane(). */ function uc_order_view($order, $view = 'view') { + $output = ''; + if ($view == 'customer') { $breadcrumb = drupal_get_breadcrumb(); $breadcrumb[2] = l(t('Order history'), 'user/'. arg(1) .'/orders'); @@ -1024,6 +1044,7 @@ } function uc_order_edit_form($form_state, $order) { + $form = array(); $form['order_id'] = array('#type' => 'hidden', '#value' => $order->order_id); $form['order_uid'] = array('#type' => 'hidden', '#value' => $order->uid); @@ -1059,13 +1080,15 @@ } 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 { @@ -1127,7 +1150,7 @@ } unset($order->products); - if (is_array($_POST['products'])) { + if (isset($_POST['products']) && is_array($_POST['products'])) { foreach ($_POST['products'] as $product) { if (!isset($product['remove']) && intval($product['qty']) > 0) { $product['data'] = unserialize($product['data']); @@ -1167,14 +1190,16 @@ * Populate the product add/edit div on the order edit screen. */ function uc_order_edit_products($order) { - if (is_array($_POST['products'])) { + $products =''; + if (isset($_POST['products']) && is_array($_POST['products'])) { foreach ($_POST['products'] as $key => $product) { $product['data'] = unserialize($product['data']); uc_order_product_save($order->order_id, (object) $product); } } + $action = isset($_POST['action']) ? $_POST['action'] : NULL; - switch ($_POST['action']) { + switch ($action) { case 'add_blank': db_query("INSERT INTO {uc_order_products} (order_id, qty) VALUES (%d, 1)", $order->order_id); if (variable_get('uc_order_logging', TRUE)) { @@ -1223,15 +1248,17 @@ while ($product = db_fetch_object($result)) { $products[] = $product; } - print uc_strip_form(drupal_get_form('uc_order_edit_products_form', $products)); exit(); } function uc_order_edit_products_form($form_state, $products) { + $form = array(); + if (($product_count = count($products)) > 0) { $form['products'] = tapir_get_table('op_products_edit_table'); - for ($i = 0; $i < $product_count; $i++) { + for ($i = 1; $i < $product_count; $i++) { + $form['products'][$i]['remove'] = array( '#type' => 'checkbox', '#name' => "products[$i][remove]", @@ -1316,19 +1343,22 @@ } function theme_uc_order_remove_product($form) { - return '' . drupal_render($form); + return $output; } /** * Form to add a line item to an order. */ function uc_order_add_line_item_form($form_state, $order, $line_item_id) { + $form = array(); + $func = _line_item_data($line_item_id, 'callback'); if (!function_exists($func) || ($form = $func('form', $order->order_id)) == NULL) { $form['title'] = array( @@ -1395,6 +1425,7 @@ * When the Catalog module or uBrowser aren't enabled, use this product select. */ function uc_order_load_product_select($order) { + $output = ''; $types = uc_product_types(); if (!empty($_POST['search'])) { @@ -1421,6 +1452,8 @@ } function uc_order_product_select_form($form_state, $order_id, $options = array()) { + $form = array(); + if (count($options) == 0) { $options[0] = t('No products found.'); } @@ -1468,6 +1501,8 @@ } function uc_order_add_product_form($form_state, $order_id, $nid) { + $form = array(); + $form['nid'] = array( '#type' => 'hidden', '#value' => $nid, @@ -1508,6 +1543,8 @@ } function uc_order_mail_invoice_form($form_state, $order) { + $form = array(); + $form['order_id'] = array( '#type' => 'hidden', '#value' => $order->order_id, @@ -1567,7 +1604,8 @@ */ function uc_order_log($order) { $result = db_query("SELECT * FROM {uc_order_log} WHERE order_id = %d ORDER BY created, order_log_id", $order->order_id); - + $output = ''; + while ($change = db_fetch_object($result)) { $user = uc_get_initials($change->uid); $rows[] = array('data' => array(format_date($change->created, 'short'), $user == '-' ? $user : l($user, 'user/'. $change->uid), $change->changes), 'valign' => 'top'); @@ -1586,6 +1624,8 @@ // Confirmation form to delete an order. function uc_order_delete_confirm_form($form_state, $order) { + $form = array(); + if (!uc_order_can_delete($order)) { drupal_set_message(t('It is not possible to delete order @id.', array('@id' => $order->order_id))); drupal_goto('admin/store/orders'); === modified file 'uc_order/uc_order.ca.inc' (properties changed: -x to +x) --- uc_order/uc_order.ca.inc 2009-06-15 15:34:44 +0000 +++ uc_order/uc_order.ca.inc 2009-06-29 23:28:48 +0000 @@ -16,6 +16,8 @@ * Implementation of hook_ca_entity(). */ function uc_order_ca_entity() { + $entities = array(); + $entities['uc_order'] = array( '#title' => t('Ubercart order object'), '#type' => 'object', @@ -34,6 +36,8 @@ * Implementation of hook_ca_trigger(). */ function uc_order_ca_trigger() { + $triggers = array(); + $triggers['uc_order_status_update'] = array( '#title' => t('Order status gets updated'), '#category' => t('Order'), @@ -116,6 +120,8 @@ * Implementation of hook_ca_condition(). */ function uc_order_ca_condition() { + $conditions = array(); + $order_arg = array( '#entity' => 'uc_order', ); @@ -293,6 +299,7 @@ * Implementation of hook_ca_action(). */ function uc_order_ca_action() { + $actoins = array(); $order_arg = array( '#entity' => 'uc_order', '#title' => t('Order'), @@ -346,6 +353,7 @@ } function uc_order_condition_check_order_status_form($form_state, $settings = array()) { + $form = array(); foreach (uc_order_status_list('general') as $status) { $options[$status['id']] = $status['title']; } @@ -363,27 +371,35 @@ } // Check the current order balance. +//could become a problem since null equates to zero. +//however the previous logic didn't account for any errors. +//therefore if no errors are sent, no errors are found. function uc_order_condition_total($order, $settings) { - switch ($settings['order_total_comparison']) { + $otc = isset($settings['order_total_comparison']) ? $settings['order_total_comparison'] : NULL; + $otv = isset($settings['order_total_value']) ? $settings['order_total_value'] : NULL; + + switch ($otc) { case 'less': - return $order->order_total < $settings['order_total_value']; + return $order->order_total < $otv; case 'less_equal': - return $order->order_total <= $settings['order_total_value']; + return $order->order_total <= $otv; case 'equal': - return $order->order_total == $settings['order_total_value']; + return $order->order_total == $otv; case 'greater_equal': - return $order->order_total >= $settings['order_total_value']; + return $order->order_total >= $otv; case 'greater': - return $order->order_total > $settings['order_total_value']; + return $order->order_total > $otv; } } function uc_order_condition_total_form($form_state, $settings = array()) { + $form = array(); + $form['order_total_value'] = array( '#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', '$') : '', @@ -416,6 +432,8 @@ } function uc_order_condition_delivery_postal_code_form($form_state, $settings = array()) { + $form = array(); + $form['pattern'] = array( '#type' => 'textfield', '#title' => uc_get_field_name('postal_code'), @@ -434,6 +452,10 @@ } function uc_order_condition_delivery_zone_form($form_state, $settings = array()) { + $form = array(); + $options = array(); + $zones = isset($setting['zones']) ? $setting['zones'] : NULL; + $result = db_query("SELECT z.*, c.country_name FROM {uc_zones} AS z LEFT JOIN {uc_countries} AS c ON z.zone_country_id = c.country_id ORDER BY c.country_name, z.zone_name"); while ($zone = db_fetch_object($result)) { $options[$zone->country_name][$zone->zone_id] = $zone->zone_name; @@ -443,7 +465,7 @@ '#type' => 'select', '#title' => uc_get_field_name('zone'), '#options' => $options, - '#default_value' => $settings['zones'], + '#default_value' => $zones, '#multiple' => TRUE, // '#required' => TRUE, ); @@ -457,6 +479,8 @@ } function uc_order_condition_delivery_country_form($form_state, $settings = array()) { + $form = array(); + $form['countries'] = uc_country_select(uc_get_field_name('country')); $form['countries']['#default_value'] = $settings['countries']; $form['countries']['#multiple'] = TRUE; @@ -475,10 +499,13 @@ } function uc_order_condition_billing_postal_code_form($form_state, $settings = array()) { + $form = array(); + $pattern = isset($settings['pattern']) ? $settings['pattern'] : NULL; + $form['pattern'] = array( '#type' => 'textfield', '#title' => uc_get_field_name('postal_code'), - '#default_value' => $settings['pattern'], + '#default_value' => $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, @@ -494,6 +521,10 @@ function uc_order_condition_billing_zone_form($form_state, $settings = array()) { $result = db_query("SELECT z.*, c.country_name FROM {uc_zones} AS z LEFT JOIN {uc_countries} AS c ON z.zone_country_id = c.country_id ORDER BY c.country_name, z.zone_name"); + $form = array(); + $zones = isset($settings['zones']) ? $settings['zones'] : NULL; + $options = array(); + while ($zone = db_fetch_object($result)) { $options[$zone->country_name][$zone->zone_id] = $zone->zone_name; } @@ -502,7 +533,7 @@ '#type' => 'select', '#title' => uc_get_field_name('zone'), '#options' => $options, - '#default_value' => $settings['zones'], + '#default_value' => $zones, '#multiple' => TRUE, // '#required' => TRUE, ); @@ -516,8 +547,10 @@ } function uc_order_condition_billing_country_form($form_state, $settings = array()) { + $form = 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; @@ -530,13 +563,13 @@ $products[] = $product->nid; } $required = array_intersect($settings['products'], $products); - if ($settings['required']) { + if (isset($settings['required']) && $settings['required']) { $required_check = $required == $settings['products']; } else { $required_check = (bool)count($required); } - if ($settings['forbidden']) { + if (isset($settings['forbidden']) && $settings['forbidden']) { $forbidden = array_diff($products, $settings['products']); $forbidden_check = (bool)count($forbidden); } @@ -547,13 +580,16 @@ } function uc_order_condition_has_products_form($form_state, $settings = array('required' => 0, 'forbidden' => 0)) { + $form = array(); + $options = array(); + $form['required'] = array('#type' => 'radios', '#title' => t('Require selected products'), '#options' => array( 0 => t('Order has any of these products.'), 1 => t('Order has all of these products.'), ), - '#default_value' => $settings['required'], + '#default_value' => isset($settings['required']) ? $settings['required'] : NULL, ); $form['forbidden'] = array('#type' => 'radios', '#title' => t('Forbid other products'), @@ -561,7 +597,7 @@ 0 => t('Order may have other products.'), 1 => t('Order has only these products.'), ), - '#default_value' => $settings['forbidden'], + '#default_value' => isset($settings['forbidden']) ? $settings['forbidden'] : NULL, ); $options = array(); $result = db_query("SELECT nid, model FROM {uc_products}"); @@ -571,7 +607,7 @@ $form['products'] = array('#type' => 'select', '#title' => t('Products'), '#options' => $options, - '#default_value' => $settings['products'], + '#default_value' => isset($settings['products']) ? $settings['products'] : NULL, '#multiple' => TRUE, ); return $form; @@ -584,7 +620,7 @@ $totals['all'] += $product->qty; $totals[$product->nid] += $product->qty; } - if (in_array('all', $settings['products'])) { + if (isset($settings['products']) && in_array('all', $settings['products'])) { $total = $totals['all']; } else { @@ -592,26 +628,31 @@ $total += $totals[$product]; } } + $pcc = isset($settings['product_count_comparison']) ? $settings['product_count_comparison'] : NULL; + $pcv = isset($settings['product_count_value']) ? $settings['product_count_value'] : NULL; switch ($settings['product_count_comparison']) { case 'less': - return $total < $settings['product_count_value']; + return $total < $pcv; case 'less_equal': - return $total <= $settings['product_count_value']; + return $total <= $pcv; case 'equal': - return $total == $settings['product_count_value']; + return $total == $pcv; case 'greater_equal': - return $total >= $settings['product_count_value']; + return $total >= $pcv; case 'greater': - return $total > $settings['product_count_value']; + return $total > $pcv; } } function uc_order_condition_count_products_form($form_state, $settings = array()) { + $form = array(); $options = array('all' => t('- All products -')); $result = db_query("SELECT nid, model FROM {uc_products} ORDER BY model"); + while ($product = db_fetch_object($result)) { $options[$product->nid] = $product->model; } + //this might need to be readdressed for eall... big assumption values are set $form['products'] = array('#type' => 'select', '#title' => t('Products'), '#options' => $options, @@ -660,23 +701,27 @@ $total += $totals[$product]; } } - switch ($settings['product_weight_comparison']) { + $pwc = isset($settings['product_weight_comparison']) ? $settings['product_weight_comparison'] : NULL; + $pwv = isset($settings['product_weight_value']) ? $settings['product_weight_value'] : NULL; + switch ($pwc) { case 'less': - return $total < $settings['product_weight_value']; + return $total < $pwv; case 'less_equal': - return $total <= $settings['product_weight_value']; + return $total <= $pwv; case 'equal': - return $total == $settings['product_weight_value']; + return $total == $pwv; case 'greater_equal': - return $total >= $settings['product_weight_value']; + return $total >= $pwv; case 'greater': - return $total > $settings['product_weight_value']; + return $total > $pwv; } } function uc_order_condition_products_weight_form($form_state, $settings = array()) { + $form = array(); $options = array('all' => t('- All products -')); $result = db_query("SELECT nid, model FROM {uc_products}"); + while ($product = db_fetch_object($result)) { $options[$product->nid] = $product->model; } @@ -745,6 +790,8 @@ } function uc_order_condition_user_name_form($form_state, $settings = array()) { + $form = array(); + $form['name'] = array( '#type' => 'textfield', '#title' => t('User name'), @@ -779,8 +826,9 @@ // Get the beginning of the day the user registered. $user_created = $account->created - ($account->created % 86400); $settings_created = gmmktime(0, 0, 0, $settings['created']['month'], $settings['created']['day'], $settings['created']['year']); + $operator = isset($settings['operator']) ? $settings['operator'] : NULL; - switch ($settings['operator']) { + switch ($operator) { case 'less': return $user_created < $settings_created; case 'less_equal': @@ -797,6 +845,8 @@ } function uc_order_condition_user_created_form($form_state, $settings = array()) { + $form = array(); + $form['operator'] = array( '#type' => 'radios', '#title' => t('Operator'), @@ -826,8 +876,9 @@ // Get the beginning of the day the user last logged in. $user_login = $account->login - ($account->login % 86400); $settings_login = gmmktime(0, 0, 0, $settings['login']['month'], $settings['login']['day'], $settings['login']['year']); + $operator = isset($settings['operator']) ? $settings['operator'] : NULL; - switch ($settings['operator']) { + switch ($operator) { case 'less': return $user_login < $settings_login; case 'less_equal': @@ -844,6 +895,8 @@ } function uc_order_condition_user_login_form($form_state, $settings = array()) { + $form = array(); + $form['operator'] = array( '#type' => 'radios', '#title' => t('Operator'), @@ -876,6 +929,8 @@ function uc_order_condition_user_language_form($form_state, $settings = array()) { $languages = language_list(); $options = array(); + $form = array(); + foreach ($languages as $language) { $options[$language->language] = $language->name.' ('.$language->native.')'; } @@ -894,7 +949,7 @@ $account = uc_order_user_load($order); $settings['roles'] = array_filter($settings['roles']); - if ($settings['operator'] == 'AND') { + if (isset($settings['operator']) && $settings['operator'] == 'AND') { foreach ($settings['roles'] as $key) { if (!isset($account->roles[$key])) { return FALSE; @@ -913,6 +968,8 @@ } function uc_order_condition_user_roles_form($form_state, $settings = array()) { + $form = array(); + $form['operator'] = array( '#type' => 'radios', '#title' => t('Operator'), @@ -945,6 +1002,7 @@ } function uc_order_action_update_status_form($form_state, $settings = array()) { + $form = array(); foreach (uc_order_status_list('general') as $status) { $options[$status['id']] = $status['title']; } @@ -970,6 +1028,8 @@ } function uc_order_action_add_comment_form($form_state, $settings = array()) { + $form = array(); + $form['comment_type'] = array( '#type' => 'radios', '#title' => t('Select an order comment type'), @@ -1026,6 +1086,8 @@ } function uc_order_action_email_form($form_state, $settings = array()) { + $form = array(); + $form['from'] = array( '#type' => 'textfield', '#title' => t('Sender'), @@ -1115,6 +1177,8 @@ } function uc_order_action_email_invoice_form($form_state, $settings = array()) { + $form = array(); + $form['from'] = array( '#type' => 'textfield', '#title' => t('Sender'), === modified file 'uc_order/uc_order.css' (properties changed: -x to +x) === modified file 'uc_order/uc_order.info' (properties changed: -x to +x) === modified file 'uc_order/uc_order.install' (properties changed: -x to +x) === modified file 'uc_order/uc_order.js' (properties changed: -x to +x) === modified file 'uc_order/uc_order.line_item.inc' (properties changed: -x to +x) --- uc_order/uc_order.line_item.inc 2009-05-06 18:27:07 +0000 +++ uc_order/uc_order.line_item.inc 2009-07-01 14:33:45 +0000 @@ -15,6 +15,8 @@ * Handle the subtotal line item. */ function uc_line_item_subtotal($op, $arg1) { + $lines = array(); + switch ($op) { case 'load': $lines[] = array( @@ -54,6 +56,8 @@ * Handle the total line item. */ function uc_line_item_total($op, $arg1) { + $lines = array(); + switch ($op) { case 'display': $lines[] = array( @@ -71,7 +75,7 @@ function uc_line_items_calculate($order) { $total = 0; - if (is_array($order->line_items)) { + if (isset($order->line_items) && is_array($order->line_items)) { foreach ($order->line_items as $item) { if (_line_item_data($item['type'], 'calculated') == TRUE) { $total += $item['amount']; @@ -147,6 +151,7 @@ $items = _line_item_list(); foreach ($items as $item) { if ($item['id'] == $item_id) { + $item[$key] = isset($item[$key]) ? $item[$key] : NULL; //might throw errors return $item[$key]; } } === modified file 'uc_order/uc_order.module' (properties changed: -x to +x) --- uc_order/uc_order.module 2009-05-07 20:12:13 +0000 +++ uc_order/uc_order.module 2009-07-01 14:29:13 +0000 @@ -16,7 +16,7 @@ require_once('uc_order.ca.inc'); /******************************************************************************* - * Hook Functions (Drupal) + * Hook Functions (Drupal) ******************************************************************************/ /** @@ -317,7 +317,7 @@ * Implementation of hook_theme(). */ function uc_order_theme() { - return array( + $ret = array( 'uc_order_state_table' => array( 'arguments' => array('form' => NULL), ), @@ -340,6 +340,7 @@ 'arguments' => array('form' => NULL), ), ); + return $ret; } /** @@ -347,6 +348,8 @@ */ function uc_order_token_values($type, $object = NULL) { $values = array(); + $ship_method = NULL; + switch ($type) { case 'order': $order = $object; @@ -430,6 +433,7 @@ */ function uc_order_token_list($type = 'all') { $tokens = array(); + if ($type == 'order' || $type == 'ubercart' || $type == 'all') { $tokens['order']['new-username'] = t('New username associated with an order if applicable.'); $tokens['order']['new-password'] = t('New password associated with an order if applicable.'); @@ -547,13 +551,15 @@ /******************************************************************************* - * Hook Functions (Ubercart) + * Hook Functions (Ubercart) ******************************************************************************/ /** * Implementation of hook_order_pane(). */ function uc_order_order_pane() { + $panes = array(); + $panes[] = array( 'id' => 'ship_to', 'callback' => 'uc_order_pane_ship_to', @@ -634,6 +640,8 @@ * Implementation of hook_order_state(). */ function uc_order_order_state() { + $state = array(); + $states[] = array( 'id' => 'canceled', 'title' => t('Canceled'), @@ -666,6 +674,8 @@ * Implementation of hook_line_item(). */ function uc_order_line_item() { + $items = array(); + $items[] = array( 'id' => 'subtotal', 'title' => t('Subtotal'), @@ -700,6 +710,8 @@ * Implementation of hook_uc_message(). */ function uc_order_uc_message() { + $message = array(); + $messages['order_update_email'] = t("[order-first-name] [order-last-name],\n\nYour order number [order-link] at [store-name] has been updated.\n\nOrder status: [order-status]\n\nOrder comment:\n[order-last-comment]\n\nBrowse to the following page to login to your account and view your order details:\n[site-login]\n\n\nThanks again,\n\n[store-name]\n[site-slogan]"); return $messages; @@ -714,6 +726,7 @@ // Theme the order state table in the order workflow settings. function theme_uc_order_state_table($form) { $header = array(t('State'), t('Default order status')); + $row = array(); foreach (element_children($form) as $state_id) { $rows[] = array( @@ -728,6 +741,8 @@ // Theme the order state table in the order workflow settings. function theme_uc_order_status_table($form) { $header = array(t('ID'), t('Title'), t('List position'), t('State'), t('Remove')); + $create = ''; + $rows = array(); foreach (element_children($form) as $state_id) { if ($state_id == 'create') { @@ -769,7 +784,7 @@ $items = array(); foreach ($panes as $name => $pane) { - $item[] = t('!title is !enabled.', array('!title' => $pane['title']['#value'], '!enabled' => $pane['uc_order_pane_'. $name .'_show_'. $parent_id]['#default_value'] ? t('enabled') : t('disabled'))); + $items[] = t('!title is !enabled.', array('!title' => $pane['title']['#value'], '!enabled' => $pane['uc_order_pane_'. $name .'_show_'. $parent_id]['#default_value'] ? t('enabled') : t('disabled'))); } $items[] = array( @@ -781,6 +796,8 @@ } function uc_order_search_form() { + $form = array(); + $form['search'] = array( '#type' => 'fieldset', '#title' => t('Search options'), @@ -894,6 +911,8 @@ } function uc_order_search_form_submit($form, &$form_state) { + $args = array(); + $keys = array( 'billing_first_name', 'billing_last_name', @@ -925,6 +944,8 @@ } function op_products_edit_table() { + $table = array(); + $table = array( '#type' => 'tapir_table', '#tree' => TRUE, @@ -1016,20 +1037,20 @@ ."billing_company = '%s', billing_street1 = '%s', billing_street2 = '%s', " ."billing_city = '%s', billing_zone = %d, billing_postal_code = '%s', billing_country = %d, " ."payment_method = '%s', data = '%s', host = '%s', modified = %d WHERE order_id = %d", - $order->uid, $order->order_status, uc_order_get_total($order), - $order->primary_email, $order->delivery_first_name, $order->delivery_last_name, $order->delivery_phone, - $order->delivery_company, $order->delivery_street1, $order->delivery_street2, - $order->delivery_city, $order->delivery_zone, $order->delivery_postal_code, - ((is_null($order->delivery_country) || $order->delivery_country == 0) ? variable_get('uc_store_country', 840) : $order->delivery_country), - $order->billing_first_name, $order->billing_last_name, $order->billing_phone, - $order->billing_company, $order->billing_street1, $order->billing_street2, - $order->billing_city, $order->billing_zone, $order->billing_postal_code, - ((is_null($order->billing_country) || $order->billing_country == 0) ? variable_get('uc_store_country', 840) : $order->billing_country), - $order->payment_method, serialize($order->data), ip_address(), time(), $order->order_id); + $order->uid, $order->order_status, uc_order_get_total($order), + $order->primary_email, $order->delivery_first_name, $order->delivery_last_name, $order->delivery_phone, + $order->delivery_company, $order->delivery_street1, $order->delivery_street2, + $order->delivery_city, $order->delivery_zone, $order->delivery_postal_code, + ((is_null($order->delivery_country) || $order->delivery_country == 0) ? variable_get('uc_store_country', 840) : $order->delivery_country), + $order->billing_first_name, $order->billing_last_name, $order->billing_phone, + $order->billing_company, $order->billing_street1, $order->billing_street2, + $order->billing_city, $order->billing_zone, $order->billing_postal_code, + ((is_null($order->billing_country) || $order->billing_country == 0) ? variable_get('uc_store_country', 840) : $order->billing_country), + $order->payment_method, serialize($order->data), ip_address(), time(), $order->order_id); // Review this query for removal in the future. -RS db_query("DELETE FROM {uc_order_products} WHERE order_id = %d", $order->order_id); - if (is_array($order->products)) { + if (isset($order->product) && is_array($order->products)) { foreach ($order->products as $product) { drupal_alter('order_product', $product, $order); uc_order_product_save($order->order_id, $product); @@ -1063,8 +1084,8 @@ function uc_order_product_save($order_id, $product) { if (!$product->order_product_id) { db_query("INSERT INTO {uc_order_products} (order_id, nid, qty, cost, price, title, manufacturer, model, weight, data) " - ."VALUES (%d, %d, %d, %f, %f, '%s', '%s', '%s', %f, '%s')", $order_id, $product->nid, $product->qty, - $product->cost, $product->price, $product->title, $product->manufacturer, $product->model, $product->weight, serialize($product->data)); + ."VALUES (%d, %d, %d, %f, %f, '%s', '%s', '%s', %f, '%s')", $order_id, $product->nid, $product->qty, + $product->cost, $product->price, $product->title, $product->manufacturer, $product->model, $product->weight, serialize($product->data)); $product->order_product_id = db_last_insert_id('uc_order_products', 'order_product_id'); } else { @@ -1072,8 +1093,8 @@ $order_id, $product->nid, $product->qty, $product->cost, $product->price, $product->title, $product->manufacturer, $product->model, $product->weight, serialize($product->data), $product->order_product_id); if (!db_affected_rows()) { db_query("INSERT INTO {uc_order_products} (order_id, nid, qty, cost, price, title, manufacturer, model, weight, data) " - ."VALUES (%d, %d, %d, %f, %f, '%s', '%s', '%s', %f, '%s')", $order_id, $product->nid, $product->qty, - $product->cost, $product->price, $product->title, $product->manufacturer, $product->model, $product->weight, serialize($product->data)); + ."VALUES (%d, %d, %d, %f, %f, '%s', '%s', '%s', %f, '%s')", $order_id, $product->nid, $product->qty, + $product->cost, $product->price, $product->title, $product->manufacturer, $product->model, $product->weight, serialize($product->data)); $product->order_product_id = db_last_insert_id('uc_order_products', 'order_product_id'); } } @@ -1165,6 +1186,9 @@ * Return an array of comments or admin comments for an order. */ function uc_order_comments_load($order_id, $admin = FALSE) { + $comments = ''; + $join = ''; + if (!$admin) { $join = " LEFT JOIN {uc_order_statuses} AS os ON oc.order_status = os.order_status_id"; } @@ -1239,7 +1263,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, //eall fix ); } } @@ -1274,7 +1298,7 @@ // Return false if any module says the update is not good to go. $return = module_invoke_all('order', 'can_update', $order, $status); for ($i = 0; $i < count($return); $i++) { - if ($return[$i] === FALSE) { + if (isset($return[$i]) && $return[$i] === FALSE) { return FALSE; } } @@ -1310,6 +1334,7 @@ */ function uc_order_log_changes($order_id, $changes) { global $user; + $items = array(); if (count($changes) == 0) { return FALSE; @@ -1379,7 +1404,7 @@ function uc_order_get_total($order, $products_only = FALSE) { $total = 0; - if (is_array($order->products)) { + if (isset($order->products) && is_array($order->products)) { foreach ($order->products as $product) { $total += $product->price * $product->qty; } @@ -1426,6 +1451,8 @@ } function _get_order_screen_titles() { + $titles = array(); + $titles = array( 'view' => t('View'), 'edit' => t('Edit'), @@ -1469,9 +1496,10 @@ $line_items = $order->line_items; $items = _line_item_list(); foreach ($items as $item) { + $item['data'] = isset($item['data']) ? $item['data'] : NULL; if (isset($item['display_only']) && $item['display_only'] == TRUE) { $result = $item['callback']('display', $order); - if (is_array($result)) { + if (isset($result) && is_array($result)) { foreach ($result as $line) { $line_items[] = array( 'line_item_id' => $line['id'], @@ -1688,7 +1716,7 @@ $statuses[$status['id']] = $status; } } - + $statuses[$status_id][$key] = isset($statuses[$status_id][$key]) ? $statuses[$status_id][$key] : NULL; return $statuses[$status_id][$key]; } @@ -1702,8 +1730,11 @@ * Valid actions for an order; returned according to the $icon_html parameter. */ function uc_order_actions($order, $icon_html = FALSE) { + $output = ""; + $order->order_status = isset($order->order_status) ? $order->order_status : NULL; $state = uc_order_status_data($order->order_status, 'state'); $order_id = array('@order_id' => $order->order_id); + $actions = array(); if (user_access('view all orders')) { $alt = t('View order @order_id.', $order_id); === modified file 'uc_order/uc_order.order_pane.inc' (properties changed: -x to +x) --- uc_order/uc_order.order_pane.inc 2009-05-26 13:10:31 +0000 +++ uc_order/uc_order.order_pane.inc 2009-06-29 23:28:48 +0000 @@ -15,6 +15,10 @@ * Handle the "Ship to" order pane. */ function uc_order_pane_ship_to($op, $arg1) { + $form = array(); + $output = ''; + $changes = array(); + switch ($op) { case 'customer': if (!uc_order_is_shippable($arg1)) { @@ -70,6 +74,7 @@ return $form; case 'edit-title': + $arg1['order_uid']['#value'] = isset($arg1['order_uid']['#value']) ? $arg1['order_uid']['#value'] : NULL; $output .= ' Select from address book. l($arg1->uid, 'user/'. $arg1->uid))) @@ -245,6 +261,7 @@ case 'edit-theme': $output = '
'; + $arg1['customer']['text'] = isset($arg1['customer']['text']) ? $arg1['customer']['text'] : NULL; foreach (element_children($arg1['customer']['text']) as $field) { $title = $arg1['customer']['text'][$field]['#title']; $arg1['customer']['text'][$field]['#title'] = NULL; @@ -274,6 +291,7 @@ return drupal_render(tapir_get_table('op_products_customer_table', $arg1->products)); case 'edit-theme': + $arg1['order_id']['#value'] = isset($arg1['order_id']['#value']) ? $arg1['order_id']['#value'] : NULL; drupal_add_js('uc_order_load_product_edit_div('. $arg1['order_id']['#value'] .');', 'inline'); $output = '
' @@ -293,7 +311,7 @@ 'nodepl' => 'products', 'select' => 'add_product_form();', ); - + $arg1['order_id']['#value'] = isset($arg1['order_id']['#value']) ? $arg1['order_id']['#value'] : NULL; $output = ''; @@ -356,7 +374,7 @@ $items = _line_item_list(); $line_items = $arg1->line_items; foreach ($items as $item) { - if ($item['add_list'] === TRUE) { + if (isset($item['add_list']) && $item['add_list'] === TRUE) { $options[$item['id']] = check_plain($item['title']); } if (isset($item['display_only']) && $item['display_only'] == TRUE) { @@ -415,7 +433,7 @@ '#type' => 'hidden', '#value' => $item['line_item_id'], ); - if (_line_item_data($item['type'], 'stored') == TRUE) { + if (isset($item['type']) && _line_item_data($item['type'], 'stored') == TRUE) { $form['line_items'][$item['line_item_id']]['title'] = array( '#type' => 'textfield', '#title' => t('Title'), @@ -461,6 +479,7 @@ .'
'; $output .= ''. drupal_render($arg1['li_delete_id']) .''; + $arg1['line_items'] = isset($arg1['line_items']) ? $arg1['line_items'] : NULL; foreach (element_children($arg1['line_items']) as $field) { $arg1['line_items'][$field]['title']['#title'] = ''; $arg1['line_items'][$field]['amount']['#title'] = ''; @@ -536,6 +555,9 @@ * Handle the "Admin Comments" order pane. */ function uc_order_pane_admin_comments($op, $arg1) { + $comments = ''; + $form = array(); + switch ($op) { case 'view': $comments = uc_order_comments_load($arg1->order_id, TRUE); @@ -555,6 +577,7 @@ return $form; case 'edit-theme': + $arg1['order_id']['#value'] = isset($arg1['order_id']['#value']) ? $arg1['order_id']['#value'] : NULL; $comments = uc_order_comments_load($arg1['order_id']['#value'], TRUE); if (is_array($comments) && count($comments) > 0) { foreach ($comments as $comment) { @@ -587,6 +610,9 @@ } function uc_order_view_update_form($form_state, $order) { + $form = array(); + $options = array(); + $form['order_comment_field'] = array( '#type' => 'fieldset', '#title' => t('Add an order comment'),