function uc_shipping_shipment_delete in Ubercart 5
Same name and namespace in other branches
- 6.2 shipping/uc_shipping/uc_shipping.module \uc_shipping_shipment_delete()
- 7.3 shipping/uc_shipping/uc_shipping.module \uc_shipping_shipment_delete()
Delete a shipment.
2 calls to uc_shipping_shipment_delete()
- uc_shipping_package_cancel_confirm_submit in shipping/
uc_shipping/ uc_shipping.module - uc_shipping_shipment_delete_confirm_submit in shipping/
uc_shipping/ uc_shipping.module - Submit handler for uc_shipping_shipment_delete_confirm().
File
- shipping/
uc_shipping/ uc_shipping.module, line 1307 - 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);
foreach ($shipment->packages as $package) {
if (file_exists($package->label_image)) {
file_delete($package->label_image);
}
}
db_query("UPDATE {uc_packages} SET sid = NULL, tracking_number = NULL, label_image = NULL WHERE sid = %d", $shipment_id);
db_query("DELETE FROM {uc_shipments} WHERE sid = %d", $shipment_id);
module_invoke_all('shipment', 'delete', $shipment);
}