You are here

function sf_prematch_edit_form_submit in Salesforce Suite 7

Same name and namespace in other branches
  1. 6.2 sf_prematch/sf_prematch.admin.inc \sf_prematch_edit_form_submit()
  2. 7.2 sf_prematch/sf_prematch.admin.inc \sf_prematch_edit_form_submit()

File

sf_prematch/sf_prematch.admin.inc, line 150
Admin functions for sf_prematch module.

Code

function sf_prematch_edit_form_submit($form, &$form_state) {
  $values = $form_state['values'];

  // Store data in the database.
  if ($values['new_prematch']) {
    db_query("INSERT INTO {salesforce_prematch} (fieldmap, primary_field, secondary_field, tertiary_field, rule) VALUES (%d, '%s', '%s', '%s', %d)", $values['fieldmap_index'], $values['primary'], $values['secondary'], $values['tertiary'], $values['rule']);
  }
  else {
    db_query("UPDATE {salesforce_prematch} SET primary_field = '%s', secondary_field = '%s', tertiary_field = '%s', rule = %d WHERE fieldmap = %d", $values['primary'], $values['secondary'], $values['tertiary'], $values['rule'], $values['fieldmap_index']);
  }

  // Display a message.
  drupal_set_message(t('The changes have been saved.'));

  // Redirect to fieldmap list or prematching page.
  if ($values['new_prematch']) {
    $form_state['redirect'] = SALESFORCE_PATH_FIELDMAPS;
  }
  else {
    $form_state['redirect'] = SALESFORCE_PATH_FIELDMAPS . '/prematching';
  }
}