You are here

function uc_order_update_6009 in Ubercart 6.2

File

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

Code

function uc_order_update_6009() {
  $ret = array();
  $count = 0;
  $result = db_query("SELECT pid, actions FROM {ca_predicates} WHERE actions LIKE '%%uc_order_email_invoice%%'");
  while ($predicate = db_fetch_object($result)) {
    $save = FALSE;
    $actions = unserialize($predicate->actions);
    foreach ($actions as $key => $action) {
      if ($action['#name'] == 'uc_order_email_invoice') {
        unset($actions[$key]['#settings']['format']);
        $save = TRUE;
      }
    }
    if ($save) {
      db_query("UPDATE {ca_predicates} SET actions = '%s' WHERE pid = %d", serialize($actions), $predicate->pid);
      $count++;
    }
  }
  $t = get_t();
  $ret[] = array(
    'success' => TRUE,
    'query' => $t('Fixed %count predicates with the action "uc_order_email_invoice".', array(
      '%count' => $count,
    )),
  );
  return $ret;
}