You are here

function uc_shipping_shipment_view in Ubercart 7.3

Same name and namespace in other branches
  1. 5 shipping/uc_shipping/uc_shipping.module \uc_shipping_shipment_view()
  2. 6.2 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_menu().

File

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

Code

function uc_shipping_shipment_view($order, $shipment) {
  $build = array();
  $origin = uc_order_address($shipment, 'o');
  $destination = uc_order_address($shipment, 'd');
  $build['pickup_address'] = array(
    '#markup' => '<div class="order-pane pos-left"><div class="order-pane-title">' . t('Pickup Address:') . '</div>' . $origin . '</div>',
  );
  $build['delivery_address'] = array(
    '#markup' => '<div class="order-pane pos-left"><div class="order-pane-title">' . t('Delivery Address:') . '</div>' . $destination . '</div>',
  );
  $rows = array();
  $rows[] = array(
    t('Ship date:'),
    format_date($shipment->ship_date, 'uc_store'),
  );
  $rows[] = array(
    t('Expected delivery:'),
    format_date($shipment->expected_delivery, 'uc_store'),
  );
  $build['schedule'] = array(
    '#theme' => 'table',
    '#rows' => $rows,
    '#attributes' => array(
      'style' => 'width: auto',
    ),
    '#prefix' => '<div class="order-pane abs-left"><div class="order-pane-title">' . t('Schedule:') . '</div>',
    '#suffix' => '</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('uc_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,
    );
  }
  $rows[] = array(
    t('Cost:'),
    array(
      'data' => array(
        '#theme' => 'uc_price',
        '#price' => $shipment->cost,
      ),
    ),
  );
  $build['details'] = array(
    '#theme' => 'table',
    '#rows' => $rows,
    '#attributes' => array(
      'style' => 'width:auto',
    ),
    '#prefix' => '<div class="order-pane abs-left"><div class="order-pane-title">' . t('Shipment Details:') . '</div>',
    '#suffix' => '</div>',
  );
  foreach ($shipment->packages as $package) {
    $build['packages'][] = uc_shipping_package_view($package);
  }
  return $build;
}