You are here

function uc_ups_update_5 in Ubercart 5

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

File

shipping/uc_ups/uc_ups.install, line 112

Code

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