You are here

function webform_civicrm_update_7301 in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 webform_civicrm.install \webform_civicrm_update_7301()
  2. 7.3 webform_civicrm.install \webform_civicrm_update_7301()

Update case features.

File

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

Code

function webform_civicrm_update_7301() {
  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 (!empty($data['case'][1])) {
      $data['case'][1]['existing_case_status'] = (array) wf_crm_aval($data['case'][1], 'case:1:status_id');
      $data['case'][1]['case'][1]['client_id'] = 1;
      $form->data = $data;
      drupal_write_record('webform_civicrm_forms', $form, 'nid');
    }
  }
  return st('Upgrade successful.');
}