You are here

function webform_civicrm_update_6204 in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 6.2 webform_civicrm.install \webform_civicrm_update_6204()
  2. 7.5 webform_civicrm.install \webform_civicrm_update_6204()
  3. 7.2 webform_civicrm.install \webform_civicrm_update_6204()
  4. 7.3 webform_civicrm.install \webform_civicrm_update_6204()

Group participant options into a single array.

File

./webform_civicrm.install, line 382
Webform CiviCRM module's install, uninstall and upgrade code.

Code

function webform_civicrm_update_6204() {
  module_load_include('inc', 'webform_civicrm', 'includes/utils');
  $db = db_query("SELECT * FROM {webform_civicrm_forms}");
  foreach ($db as $form) {
    $data = unserialize($form->data);
    if (isset($data['event_type'])) {
      $data['reg_options'] = array(
        'event_type' => $data['event_type'],
        'show_past_events' => wf_crm_aval($data, 'show_past_events', 0),
      );
      $form = (array) $form;
      $form['data'] = $data;
      drupal_write_record('webform_civicrm_forms', $form, 'nid');
    }
  }
  return st('Upgrade successful. Note: If you upgraded via drush you will now need to clear all caches with the command drush cc');
}