You are here

function uc_order_pane_customer in Ubercart 5

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

Handle the "Customer Info" order pane.

1 string reference to 'uc_order_pane_customer'
uc_order_order_pane in uc_order/uc_order.module
Implementation of hook_order_pane().

File

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

Code

function uc_order_pane_customer($op, $arg1) {
  switch ($op) {
    case 'view':
      $output = t('Customer number: ') . l($arg1->uid, 'user/' . $arg1->uid) . '<br />' . t('Primary e-mail:') . '<br />' . check_plain($arg1->primary_email);
      return $output;
    case 'edit-form':
      $form['customer'] = array(
        '#type' => 'fieldset',
        '#title' => t("Modify 'Customer info'"),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['customer']['uid'] = array(
        '#type' => 'hidden',
        '#default_value' => $arg1->uid,
      );
      $form['customer']['text']['uid_text'] = array(
        '#type' => 'textfield',
        '#title' => t('Customer number'),
        '#default_value' => $arg1->uid,
        '#maxlength' => 10,
        '#size' => 10,
        '#disabled' => TRUE,
      );
      $form['customer']['primary_email'] = array(
        '#type' => 'hidden',
        '#default_value' => $arg1->primary_email,
      );
      $form['customer']['text']['primary_email_text'] = array(
        '#type' => 'textfield',
        '#title' => t('Primary e-mail'),
        '#default_value' => $arg1->primary_email,
        '#maxlength' => 64,
        '#size' => 32,
        '#disabled' => TRUE,
      );
      return $form;
    case 'edit-title':
      $output .= ' <img src="' . base_path() . drupal_get_path('module', 'uc_store') . '/images/order_view.gif" alt="' . t('Search for an existing customer.') . '" ' . 'title="' . t('Search for an existing customer.') . '" onclick="load_customer_search();" ' . 'style="position: relative; top: 2px; cursor: pointer;" />';
      $output .= ' <img src="' . base_path() . drupal_get_path('module', 'uc_store') . '/images/menu_customers_small.gif" alt="' . t('Create a new customer.') . '" ' . 'title="' . t('Create a new customer.') . '" onclick="load_new_customer_form();" ' . 'style="position: relative; top: 2px; cursor: pointer;" />';
      return $output;
    case 'edit-theme':
      $output = '<div id="customer-select"></div><table class="order-edit-table">';
      foreach (element_children($arg1['customer']['text']) as $field) {
        $title = $arg1['customer']['text'][$field]['#title'];
        $arg1['customer']['text'][$field]['#title'] = NULL;
        $output .= '<tr><td class="oet-label">' . $title . ':</td><td>' . drupal_render($arg1['customer']['text'][$field]) . '</td></tr>';
      }
      $output .= '</table>' . drupal_render($arg1['customer']['primary_email']) . drupal_render($arg1['customer']['uid']);
      return $output;
    case 'edit-process':
      $changes['uid'] = $arg1['uid'];
      $changes['primary_email'] = $arg1['primary_email'];
      return $changes;
  }
}