You are here

function uc_fedex_admin_settings_validate in FedEx Shipping 7.2

Same name and namespace in other branches
  1. 5 uc_fedex.module \uc_fedex_admin_settings_validate()
  2. 6.2 uc_fedex.admin.inc \uc_fedex_admin_settings_validate()
  3. 6 uc_fedex.module \uc_fedex_admin_settings_validate()
  4. 7 uc_fedex.module \uc_fedex_admin_settings_validate()

Validation handler for uc_fedex_admin_settings form.

Requires password only if it hasn't been set.

See also

uc_fedex_admin_settings()

1 string reference to 'uc_fedex_admin_settings_validate'
uc_fedex_admin_settings in ./uc_fedex.admin.inc
Default FedEx Web Services API settings.

File

./uc_fedex.admin.inc, line 372
FedEx Shipping Quotes module administration menu and callbacks.

Code

function uc_fedex_admin_settings_validate($form, &$form_state) {
  $old_password = variable_get('uc_fedex_user_credential_password', '');
  if (!$form_state['values']['uc_fedex_user_credential_password']) {
    if ($old_password) {
      form_set_value($form['uc_fedex_credentials']['uc_fedex_user_credential_password'], $old_password, $form_state);
    }
    else {
      form_set_error('uc_fedex_user_credential_password', t('Password field is required.'));
    }
  }
  if (!is_numeric($form_state['values']['uc_fedex_rate_markup'])) {
    form_set_error('uc_fedex_rate_markup', t('Rate markup must be a numeric value.'));
  }
  if (!is_numeric($form_state['values']['uc_fedex_weight_markup'])) {
    form_set_error('uc_fedex_weight_markup', t('Weight markup must be a numeric value.'));
  }
}