You are here

public function UserContactImportSettings::preImport in CRM Core 7

Preprocess import.

Overrides CRMCoreDataImportSettings::preImport

File

modules/crm_core_data_import/plugins/settings/UserContactImportSettings.inc, line 207

Class

UserContactImportSettings

Code

public function preImport($importer, &$migration) {
  if ($migration
    ->getEntityType() == 'user') {
    $importer_settings = $importer
      ->getSettings();

    // Prevent creating contacts automatically.
    if (empty($importer_settings['user_contact']['create_automatically']) || $importer_settings['user_contact']['create_automatically'] == 0) {
      $migration
        ->addFieldMapping('crm_core_no_auto_sync')
        ->defaultValue(TRUE);
    }
  }
}