You are here

function _sf_node_import_cck_date in Salesforce Suite 6.2

1 string reference to '_sf_node_import_cck_date'
_sf_contrib_add_fields in sf_contrib/sf_contrib.module

File

sf_contrib/sf_contrib.module, line 196
Provides integration with Location and CCK.

Code

function _sf_node_import_cck_date(&$node, $drupal_fieldname, $drupal_field_definition, $sf_data, $sf_fieldname, $sf_field_definition) {
  if (empty($sf_data->{$sf_fieldname})) {
    return;
  }
  list($fieldname, $column) = explode(':', $drupal_fieldname, 2);
  if (empty($column)) {
    $column = 'value';
  }
  switch ($node->{$fieldname}[0]['date_type']) {
    case 'datestamp':
      $to_type = DATE_UNIX;
      break;
    case 'datetime':
      $to_type = DATE_DATETIME;
      break;
    case 'date':
      $to_type = DATE_ISO;
      break;
  }
  $date = date_convert($sf_data->{$sf_fieldname}, DATE_ISO, $to_type);
  $node->{$fieldname}[0][$column] = $date;
}