You are here

function uc_shipping_shipment_load in Ubercart 5

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

Load a shipment and it's packages.

7 calls to uc_shipping_shipment_load()
uc_shipping_order_pane_packages in shipping/uc_shipping/uc_shipping.module
uc_shipping_package_cancel_confirm_submit in shipping/uc_shipping/uc_shipping.module
uc_shipping_package_view in shipping/uc_shipping/uc_shipping.module
Display the details of a package.
uc_shipping_shipment_delete in shipping/uc_shipping/uc_shipping.module
Delete a shipment.
uc_shipping_shipment_delete_confirm_submit in shipping/uc_shipping/uc_shipping.module
Submit handler for uc_shipping_shipment_delete_confirm().

... See full list

File

shipping/uc_shipping/uc_shipping.module, line 1242
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_fetch_object(db_query("SELECT * FROM {uc_shipments} WHERE sid = %d", $shipment_id));
  if ($shipment) {
    $result = db_query("SELECT package_id FROM {uc_packages} WHERE sid = %d", $shipment_id);
    $packages = array();
    while ($package = db_fetch_object($result)) {
      $packages[$package->package_id] = uc_shipping_package_load($package->package_id);
    }
    $shipment->packages = $packages;
    $extra = module_invoke_all('shipment', 'load', $shipment);
    if (is_array($extra)) {
      foreach ($extra as $key => $value) {
        $shipment->{$key} = $value;
      }
    }
  }
  return $shipment;
}