function uc_shipping_make_shipment in Ubercart 7.3
Same name and namespace in other branches
- 5 shipping/uc_shipping/uc_shipping.module \uc_shipping_make_shipment()
- 6.2 shipping/uc_shipping/uc_shipping.admin.inc \uc_shipping_make_shipment()
Default method to send packages on a shipment.
1 string reference to 'uc_shipping_make_shipment'
- uc_shipping_menu in shipping/
uc_shipping/ uc_shipping.module - Implements hook_menu().
File
- shipping/
uc_shipping/ uc_shipping.admin.inc, line 1163 - Shipping administration menu items.
Code
function uc_shipping_make_shipment($order) {
$args = func_get_args();
if (count($args) > 2) {
$breadcrumb = drupal_get_breadcrumb();
$breadcrumb[] = l(t('Shipments'), 'admin/store/orders/' . $order->order_id . '/shipments');
drupal_set_breadcrumb($breadcrumb);
$order = array_shift($args);
$method_id = array_shift($args);
$package_ids = $args;
$methods = module_invoke_all('uc_shipping_method');
if (isset($methods[$method_id])) {
$method = $methods[$method_id];
if (isset($method['ship']['file'])) {
$inc_file = drupal_get_path('module', $method['module']) . '/' . $method['ship']['file'];
if (is_file($inc_file)) {
require_once $inc_file;
}
}
return drupal_get_form($method['ship']['callback'], $order, $package_ids);
}
else {
$shipment = new stdClass();
$shipment->order_id = $order->order_id;
$shipment->packages = array();
foreach ($package_ids as $id) {
$package = uc_shipping_package_load($id);
$shipment->packages[$id] = $package;
}
return drupal_get_form('uc_shipping_shipment_edit', $order, $shipment);
}
}
else {
drupal_set_message(t('There is no sense in making a shipment with no packages on it, right?'));
drupal_goto('admin/store/orders/' . $args[0]->order_id . '/shipments/new');
}
}