You are here

function uc_shipping_shipment_load in Ubercart 7.3

Same name and namespace in other branches
  1. 5 shipping/uc_shipping/uc_shipping.module \uc_shipping_shipment_load()
  2. 6.2 shipping/uc_shipping/uc_shipping.module \uc_shipping_shipment_load()

Loads a shipment and its packages.

5 calls to uc_shipping_shipment_load()
uc_shipping_order_pane_packages in shipping/uc_shipping/uc_shipping.module
Shipping order pane callback.
uc_shipping_package_cancel_confirm_submit in shipping/uc_shipping/uc_shipping.admin.inc
Form submission handler for uc_shipping_package_cancel_confirm().
uc_shipping_package_view in shipping/uc_shipping/uc_shipping.module
Displays the details of a package.
uc_shipping_shipment_delete in shipping/uc_shipping/uc_shipping.module
Deletes a shipment.
uc_shipping_shipment_delete_confirm_submit in shipping/uc_shipping/uc_shipping.admin.inc
Submit handler for uc_shipping_shipment_delete_confirm().

File

shipping/uc_shipping/uc_shipping.module, line 542
Organizes ordered products into packages and sets them up for shipment. Shipping method modules may add functionality to generate shipping labels and tracking numbers.

Code

function uc_shipping_shipment_load($shipment_id) {
  $shipment = db_query("SELECT * FROM {uc_shipments} WHERE sid = :sid", array(
    ':sid' => $shipment_id,
  ))
    ->fetchObject();
  if ($shipment) {
    $result = db_query("SELECT package_id FROM {uc_packages} WHERE sid = :sid", array(
      ':sid' => $shipment_id,
    ));
    $packages = array();
    foreach ($result as $package) {
      $packages[$package->package_id] = uc_shipping_package_load($package->package_id);
    }
    $shipment->packages = $packages;
    $extra = module_invoke_all('uc_shipment', 'load', $shipment);
    if (is_array($extra)) {
      foreach ($extra as $key => $value) {
        $shipment->{$key} = $value;
      }
    }
  }
  return $shipment;
}