You are here

function uc_shipping_shipment_load in Ubercart 6.2

Same name and namespace in other branches
  1. 5 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 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
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.admin.inc
Submit handler for uc_shipping_shipment_delete_confirm().
1 string reference to 'uc_shipping_shipment_load'
uc_shipping_ca_entity in shipping/uc_shipping/uc_shipping.ca.inc
@file Conditional actions hooks for uc_shipping.module.

File

shipping/uc_shipping/uc_shipping.module, line 505

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;
}