You are here

function uc_usps_admin_settings_submit in Ubercart 7.3

Submit handler for uc_usps_admin_settings form.

See also

uc_usps_admin_settings()

uc_usps_admin_settings_validate()

File

shipping/uc_usps/uc_usps.admin.inc, line 239
USPS administration menu items.

Code

function uc_usps_admin_settings_submit($form, &$form_state) {
  $fields = array(
    'uc_usps_user_id',
    'uc_usps_online_rates',
    'uc_usps_env_services',
    'uc_usps_services',
    'uc_usps_intl_env_services',
    'uc_usps_intl_services',
    'uc_usps_rate_markup_type',
    'uc_usps_rate_markup',
    'uc_usps_weight_markup_type',
    'uc_usps_weight_markup',
    'uc_usps_all_in_one',
    'uc_usps_insurance',
    'uc_usps_delivery_confirmation',
    'uc_usps_signature_confirmation',
  );
  foreach ($fields as $key) {
    $value = $form_state['values'][$key];
    if (is_array($value) && isset($form_state['values']['array_filter'])) {
      $value = array_keys(array_filter($value));
    }
    variable_set($key, $value);
  }
  drupal_set_message(t('The configuration options have been saved.'));
  cache_clear_all();
  drupal_theme_rebuild();
}