You are here

function uc_shipping_shipment_delete in Ubercart 7.3

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

Deletes a shipment.

3 calls to uc_shipping_shipment_delete()
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_shipment_delete_confirm_submit in shipping/uc_shipping/uc_shipping.admin.inc
Submit handler for uc_shipping_shipment_delete_confirm().
uc_shipping_uc_order in shipping/uc_shipping/uc_shipping.module
Implements hook_uc_order().

File

shipping/uc_shipping/uc_shipping.module, line 615
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_delete($shipment_id) {
  $shipment = uc_shipping_shipment_load($shipment_id);
  db_update('uc_packages')
    ->fields(array(
    'sid' => NULL,
    'tracking_number' => NULL,
    'label_image' => NULL,
  ))
    ->condition('sid', $shipment_id)
    ->execute();
  db_delete('uc_shipments')
    ->condition('sid', $shipment_id)
    ->execute();
  foreach ($shipment->packages as $package) {
    if (isset($package->label_image)) {
      file_delete($package->label_image);
      unset($package->label_image);
    }
  }
  module_invoke_all('uc_shipment', 'delete', $shipment);
}