You are here

function crm_core_match_engine_status_toggle in CRM Core 7

Page callback to toggle matching engine status.

1 string reference to 'crm_core_match_engine_status_toggle'
crm_core_match_menu in modules/crm_core_match/crm_core_match.module
Implements hook_menu().

File

modules/crm_core_match/crm_core_match.module, line 156
Manages matching engines for identifying duplicate contacts in CRM Core. Allows CRM Core to install, enable and disable matching engines.

Code

function crm_core_match_engine_status_toggle($engine_machine_name, $to_status) {
  $status = NULL;
  switch ($to_status) {
    case 'enable':
      $status = 1;
      break;
    case 'disable':
      $status = 0;
      break;
  }
  if (isset($status)) {
    db_merge('crm_core_match_engines')
      ->condition('machine_name', $engine_machine_name)
      ->fields(array(
      'status' => $status,
      'machine_name' => $engine_machine_name,
    ))
      ->execute();
    drupal_set_message(t('Status changed successfully.'));
  }
  $destination = drupal_get_destination();
  drupal_goto($destination['destination']);
}