You are here

function uc_shipping_shipment_view in Ubercart 6.2

Same name and namespace in other branches
  1. 5 shipping/uc_shipping/uc_shipping.module \uc_shipping_shipment_view()
  2. 7.3 shipping/uc_shipping/uc_shipping.admin.inc \uc_shipping_shipment_view()

Displays shipment details.

1 string reference to 'uc_shipping_shipment_view'
uc_shipping_menu in shipping/uc_shipping/uc_shipping.module
Implements hook_shipping_menu().

File

shipping/uc_shipping/uc_shipping.admin.inc, line 598
Shipping administration menu items.

Code

function uc_shipping_shipment_view($order, $shipment) {
  $breadcrumb = drupal_get_breadcrumb();
  $breadcrumb[] = l(t('Administer'), 'admin');
  $breadcrumb[] = l(t('Store administration'), 'admin/store');
  $breadcrumb[] = l(t('Orders'), 'admin/store/orders');
  $breadcrumb[] = l(t('Order @id', array(
    '@id' => $order->order_id,
  )), 'admin/store/orders/' . $order->order_id);
  $breadcrumb[] = l(t('Shipments'), 'admin/store/orders/' . $order->order_id . '/shipments');
  drupal_set_breadcrumb($breadcrumb);
  $output = '';
  $origin = uc_order_address($shipment, 'o');
  $destination = uc_order_address($shipment, 'd');
  $output .= '<div class="order-pane pos-left"><div class="order-pane-title">' . t('Pickup Address:') . '</div>' . $origin . '</div>';
  $output .= '<div class="order-pane pos-left"><div class="order-pane-title">' . t('Delivery Address:') . '</div>' . $destination . '</div>';
  $output .= '<div class="order-pane abs-left"><div class="order-pane-title">' . t('Schedule:') . '</div>';
  $rows = array();
  $rows[] = array(
    t('Ship date:'),
    format_date($shipment->ship_date, 'custom', 'D, ' . variable_get('uc_date_format_default', 'm/d/Y')),
  );
  $rows[] = array(
    t('Expected delivery:'),
    format_date($shipment->expected_delivery, 'custom', 'D, ' . variable_get('uc_date_format_default', 'm/d/Y')),
  );
  $output .= theme('table', array(), $rows, array(
    'style' => 'width: auto',
  ));
  $output .= '</div>';
  $output .= '<div class="order-pane abs-left"><div class="order-pane-title">' . t('Shipment Details:') . '</div>';
  $rows = array();
  $rows[] = array(
    t('Carrier:'),
    check_plain($shipment->carrier),
  );
  if ($shipment->transaction_id) {
    $rows[] = array(
      t('Transaction ID:'),
      check_plain($shipment->transaction_id),
    );
  }
  if ($shipment->tracking_number) {
    $rows[] = array(
      t('Tracking Number:'),
      check_plain($shipment->tracking_number),
    );
  }
  $methods = module_invoke_all('shipping_method');
  if (isset($methods[$shipment->shipping_method]['quote']['accessorials'][$shipment->accessorials])) {
    $rows[] = array(
      t('Services:'),
      $methods[$shipment->shipping_method]['quote']['accessorials'][$shipment->accessorials],
    );
  }
  else {
    $rows[] = array(
      t('Services:'),
      $shipment->accessorials,
    );
  }
  $context = array(
    'revision' => 'themed',
    'type' => 'amount',
  );
  $rows[] = array(
    t('Cost:'),
    uc_price($shipment->cost, $context, array(
      'label' => FALSE,
    )),
  );
  $output .= theme('table', array(), $rows, array(
    'style' => 'width:auto',
  ));
  $output .= '</div>';
  foreach ($shipment->packages as $package) {
    $output .= uc_shipping_package_view($package);
  }
  return $output;
}