You are here

function uc_order_view_update_form in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_order/uc_order_order_pane.inc \uc_order_view_update_form()
  2. 6.2 uc_order/uc_order.order_pane.inc \uc_order_view_update_form()

Form to save order comments and update the order status.

See also

uc_order_view_update_form_submit()

1 string reference to 'uc_order_view_update_form'
uc_order_pane_update in uc_order/uc_order.order_pane.inc
Handles the "Update" order pane.

File

uc_order/uc_order.order_pane.inc, line 953
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($form, &$form_state, $order) {
  $form['order_comment_field'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add an order comment'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['order_comment_field']['order_comment'] = array(
    '#type' => 'textarea',
    '#description' => t('Order comments are used primarily to communicate with the customer.'),
  );
  $form['admin_comment_field'] = array(
    '#type' => 'fieldset',
    '#title' => t('Add an admin comment'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['admin_comment_field']['admin_comment'] = array(
    '#type' => 'textarea',
    '#description' => t('Admin comments are only seen by store administrators.'),
  );
  $form['current_status'] = array(
    '#type' => 'hidden',
    '#value' => $order->order_status,
  );
  $form['order_id'] = array(
    '#type' => 'hidden',
    '#value' => $order->order_id,
  );
  $form['controls'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        'uc-inline-form',
        'clearfix',
      ),
    ),
    '#weight' => 10,
  );
  foreach (uc_order_status_list() as $status) {
    $options[$status['id']] = $status['title'];
  }
  $form['controls']['status'] = array(
    '#type' => 'select',
    '#title' => t('Order status'),
    '#default_value' => $order->order_status,
    '#options' => $options,
  );
  $form['controls']['notify'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send e-mail notification on update.'),
  );
  $form['controls']['actions'] = array(
    '#type' => 'actions',
  );
  $form['controls']['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Update'),
  );
  return $form;
}