You are here

function uc_order_view_update_form_submit in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_order/uc_order.order_pane.inc \uc_order_view_update_form_submit()
  2. 7.3 uc_order/uc_order.order_pane.inc \uc_order_view_update_form_submit()

File

uc_order/uc_order_order_pane.inc, line 641
This file contains the callbacks for the default order panes supplied with Ubercart and their corresponding helper functions.

Code

function uc_order_view_update_form_submit($form_id, $form_values) {
  global $user;
  if ($form_values['status'] != $form_values['current_status']) {
    if (uc_order_update_status($form_values['order_id'], $form_values['status'])) {
      if (is_null($form_values['order_comment']) || strlen($form_values['order_comment']) == 0) {
        uc_order_comment_save($form_values['order_id'], $user->uid, '-', 'order', $form_values['status'], $form_values['notify']);
      }
    }
  }
  if (!is_null($form_values['order_comment']) && strlen(trim($form_values['order_comment'])) > 0) {
    uc_order_comment_save($form_values['order_id'], $user->uid, $form_values['order_comment'], 'order', $form_values['status'], $form_values['notify']);
  }
  if (!is_null($form_values['admin_comment']) && strlen(trim($form_values['admin_comment'])) > 0) {
    uc_order_comment_save($form_values['order_id'], $user->uid, $form_values['admin_comment']);
  }
  drupal_set_message(t('Order updated.'));
}