You are here

function uc_usps_update_3 in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_usps/uc_usps.install \uc_usps_update_3()

File

shipping/uc_usps/uc_usps.install, line 74

Code

function uc_usps_update_3() {
  $ret = array();
  $markup = variable_get('uc_usps_markup', '0%');
  if (strpos($markup, '%') !== false) {
    variable_set('uc_usps_markup_type', 'percentage');
    variable_set('uc_usps_markup', floatval(rtrim($markup, '%')));
  }
  else {
    if (strpos($markup, '$') !== false) {
      variable_set('uc_usps_markup_type', 'currency');
      variable_set('uc_usps_markup', floatval(ltrim($markup, '$')));
    }
    else {
      if (floatval($markup)) {
        variable_set('uc_usps_markup_type', 'multiplier');
        variable_set('uc_usps_markup', floatval($markup));
      }
    }
  }
  $ret[] = array(
    'success' => true,
    'query' => 'Added USPS markup type.',
  );
  return $ret;
}