You are here

function uc_order_pane_bill_to in Ubercart 7.3

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

Handles the "Bill to" order pane.

1 string reference to 'uc_order_pane_bill_to'
uc_order_uc_order_pane in uc_order/uc_order.module
Implements hook_uc_order_pane().

File

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

Code

function uc_order_pane_bill_to($op, $order, &$form = NULL, &$form_state = NULL) {
  switch ($op) {
    case 'view':
    case 'customer':
      $build = array(
        '#markup' => uc_order_address($order, 'billing') . '<br />' . check_plain($order->billing_phone),
      );
      return $build;
    case 'edit-form':
      $form['bill_to'] = array(
        '#type' => 'uc_address',
        '#default_value' => $order,
        '#required' => FALSE,
        '#attributes' => array(
          'class' => array(
            'uc-store-address-field',
          ),
        ),
        '#key_prefix' => 'billing',
      );
      return $form;
    case 'edit-theme':
      $output = '<div class="order-pane-icons">';
      $output .= ' <img src="' . base_path() . drupal_get_path('module', 'uc_store') . '/images/address_book.gif" alt="' . t('Select from address book.') . '" ' . 'title="' . t('Select from address book.') . '" onclick="load_address_select(' . $form['order_uid']['#value'] . ', \'#billing_address_select\', \'billing\');" />';
      $output .= ' <img src="' . base_path() . drupal_get_path('module', 'uc_store') . '/images/copy.gif" alt="' . t('Copy shipping information.') . '" title="' . t('Copy shipping information.') . '" onclick="uc_order_copy_shipping_to_billing();" />';
      $output .= '</div>';
      $output .= '<div id="billing_address_select"></div>';
      return $output . drupal_render($form['bill_to']);
    case 'edit-process':
      $changes = array();
      foreach ($form_state['values'] as $key => $value) {
        if (substr($key, 0, 8) == 'billing_') {
          if (uc_address_field_enabled(substr($key, 8))) {
            $changes[$key] = $value;
          }
        }
      }
      return $changes;
  }
}