You are here

function drush_sf_import_sf_get_updated in Salesforce Suite 6.2

Same name and namespace in other branches
  1. 7.2 sf_import/sf_import.drush.inc \drush_sf_import_sf_get_updated()

Calls SF Import Get Updated

File

sf_import/sf_import.drush.inc, line 71
Drush integration for Salesforce Import module. Provides commands to import Salesforce data.

Code

function drush_sf_import_sf_get_updated() {
  drush_print('Checking for updated records...');
  $records = sf_import_import_records();
  if (is_array($records) && count($records) > 0) {
    drush_print("Returned " . count($records) . " record(s)");
    $table = array(
      array(
        'SFID',
        'Fieldmap',
        'Time Imported',
      ),
    );
    $results = array_merge($table, $records);
    drush_print_table($results);
    $no_process = drush_get_option('no-process', FALSE);
    if ($no_process) {
      return;
    }
    drush_print("Processing records...");
    $process = _sf_import_process_records();
    if (is_array($process) && count($process) > 0) {
      drush_print("Processed " . count($process) . " record(s)");
      $table = array(
        array(
          'SFID',
          'OID',
          'Fieldmap',
        ),
      );
      $results = array_merge($table, $process);
      drush_print_table($results);
    }
    else {
      drush_print('Did not process any records.');
    }
  }
  else {
    drush_print('No new records.');
  }
}