You are here

function uc_shipping_package_delete in Ubercart 7.3

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

Deletes a package.

2 calls to uc_shipping_package_delete()
uc_shipping_package_delete_confirm_submit in shipping/uc_shipping/uc_shipping.admin.inc
Submit handler for uc_shipping_package_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 520
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_package_delete($package_id) {

  // @todo: Make these delete functions take the actual object.
  $package = uc_shipping_package_load($package_id);
  db_delete('uc_packages')
    ->condition('package_id', $package_id)
    ->execute();
  db_delete('uc_packaged_products')
    ->condition('package_id', $package_id)
    ->execute();
  if (isset($package->label_image)) {
    file_usage_delete($package->label_image, 'uc_shipping', 'package', $package_id);
    file_delete($package->label_image);
  }
  drupal_set_message(t('Package @id has been deleted.', array(
    '@id' => $package_id,
  )));
}