You are here

function uc_order_update_6013 in Ubercart 6.2

Convert the settings for the uc_order_condition_has_products to models.

File

uc_order/uc_order.install, line 922
Install, update and uninstall functions for the uc_order module.

Code

function uc_order_update_6013() {
  $ret = array();
  $models = array();
  $count = 0;
  $result = db_query("SELECT pid, conditions FROM {ca_predicates} WHERE conditions LIKE '%%uc_order_condition_has_products%%'");
  while ($predicate = db_fetch_object($result)) {
    $conditions = unserialize($predicate->conditions);
    $save = uc_order_6013_condition_helper($conditions['#conditions'], $predicate->pid);
    if ($save) {
      db_query("UPDATE {ca_predicates} SET conditions = '%s' WHERE pid = '%s'", serialize($conditions), $predicate->pid);
      $count++;
    }
  }
  $t = get_t();
  $ret[] = array(
    'success' => TRUE,
    'query' => $t('Fixed %count predicates with the condition "uc_order_condition_has_products".', array(
      '%count' => $count,
    )),
  );
  return $ret;
}