You are here

function uc_termsofservice_update_6101 in Ubercart Terms of Service 6

Implements hook_update_N().

File

./uc_termsofservice.install, line 20
Install, update, and uninstall functions for the uc_termsofservice module.

Code

function uc_termsofservice_update_6101() {
  $ret = array();

  // Update the cart variables.
  if (variable_get('uc_termsofservice_target', 0) == 1) {
    variable_set('uc_termsofservice_cart_node', variable_get('uc_termsofservice_node', 0));
    variable_set('uc_termsofservice_cart_popup', variable_get('uc_termsofservice_popup', 0));
  }
  elseif (variable_get('uc_termsofservice_target', 0) == 2) {
    variable_set('uc_termsofservice_checkout_required', variable_get('uc_termsofservice_required', 0));
    variable_set('uc_termsofservice_checkout_node', variable_get('uc_termsofservice_node', 0));
    variable_set('uc_termsofservice_checkout_popup', variable_get('uc_termsofservice_popup', 0));
  }

  // Delete the useless variables.
  $variables = array(
    'uc_termsofservice_target',
    'uc_termsofservice_required',
    'uc_termsofservice_node',
    'uc_termsofservice_popup',
  );
  foreach ($variables as $variable) {
    variable_del($variable);
  }
  return $ret;
}