You are here

function uc_ups_product_alter_validate in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 shipping/uc_ups/uc_ups.module \uc_ups_product_alter_validate()
  2. 5 shipping/uc_ups/uc_ups.module \uc_ups_product_alter_validate()
  3. 6.2 shipping/uc_ups/uc_ups.module \uc_ups_product_alter_validate()

Validation handler for UPS product fields.

See also

uc_ups_form_alter()

1 string reference to 'uc_ups_product_alter_validate'
uc_ups_form_alter in shipping/uc_ups/uc_ups.module
Implements hook_form_alter().

File

shipping/uc_ups/uc_ups.module, line 133
UPS shipping quote module.

Code

function uc_ups_product_alter_validate($form, &$form_state) {
  if (isset($form_state['values']['shippable']) && ($form_state['values']['shipping_type'] == 'small_package' || empty($form_state['values']['shipping_type']) && variable_get('uc_store_shipping_type', 'small_package') == 'small_package')) {
    if ($form_state['values']['ups']['pkg_type'] == '02' && (empty($form_state['values']['dim_length']) || empty($form_state['values']['dim_width']) || empty($form_state['values']['dim_height']))) {
      form_set_error('base][dimensions', t('Dimensions are required for custom packaging.'));
    }
  }
}