function uc_shipping_shipment_edit_validate in Ubercart 6.2
Same name and namespace in other branches
- 7.3 shipping/uc_shipping/uc_shipping.admin.inc \uc_shipping_shipment_edit_validate()
Ensures the package dimensions are positive numbers.
See also
uc_shipping_shipment_submit()
File
- shipping/
uc_shipping/ uc_shipping.admin.inc, line 927 - Shipping administration menu items.
Code
function uc_shipping_shipment_edit_validate($form, &$form_state) {
foreach ($form_state['values']['packages'] as $key => $package) {
foreach (array(
'length',
'width',
'height',
) as $property) {
if (!empty($package['dimensions'][$property]) && (!is_numeric($package['dimensions'][$property]) || $package['dimensions'][$property] < 0)) {
form_set_error('packages][' . $key . '][dimensions][' . $property, t('@property must be a positive number. No commas and only one decimal point.', array(
'@property' => ucfirst($property),
)));
}
}
}
}