From 085edd9f5363f81a3cb72059cc2996a93388f319 Mon Sep 17 00:00:00 2001
From: Chris Hood <chris@univate.com.au>
Date: Fri, 31 Aug 2012 11:25:51 +1000
Subject: [PATCH] #1764562: update $map->drupal to $map->drupal_entity

---
 sf_import/sf_import.batch.inc    |    2 +-
 sf_import/sf_import.drush.inc    |    8 ++++----
 sf_prematch/sf_prematch.main.inc |    4 ++--
 sf_queue/sf_queue.module         |    6 +++---
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/sf_import/sf_import.batch.inc b/sf_import/sf_import.batch.inc
index b15bdb2..b7d3159 100644
--- a/sf_import/sf_import.batch.inc
+++ b/sf_import/sf_import.batch.inc
@@ -72,7 +72,7 @@ function sf_import_batchjob($fieldmap_key, $extra, &$context) {
 
     // Load the object definitions.
     $context['sandbox']['salesforce']['drupal_object'] =
-      salesforce_api_fieldmap_objects_load('drupal', $map->drupal);
+      salesforce_api_fieldmap_objects_load('drupal', $map->drupal_entity);
     // $context['sandbox']['salesforce']['salesforce_object'] =
     //   salesforce_api_fieldmap_objects_load('salesforce', $map['salesforce']);
     $result = db_query('SELECT oid, sfid FROM {salesforce_object_map} WHERE name = :name', array(':name' => $map->name));
diff --git a/sf_import/sf_import.drush.inc b/sf_import/sf_import.drush.inc
index b5214fe..2011b2b 100644
--- a/sf_import/sf_import.drush.inc
+++ b/sf_import/sf_import.drush.inc
@@ -108,7 +108,7 @@ function _drush_sf_import_show_fieldmaps() {
   foreach ($fieldmaps as $k => $map) {
     $name = salesforce_api_fieldmap_object_label('salesforce', $map->salesforce)
             . ' => '
-            . salesforce_api_fieldmap_object_label('drupal', $map->drupal);
+            . salesforce_api_fieldmap_object_label('drupal', $map->drupal_entity);
 
     $table[] = array($k, $name, $map->description);
   }
@@ -134,7 +134,7 @@ function drush_sf_import_sf_fieldmap($fieldmap_key = NULL) {
   // Display field mapping
   $out[] = array('Name', $map->name);
   $out[] = array('Description', $map->description);
-  $out[] = array('Drupal type', $map->drupal);
+  $out[] = array('Drupal type', $map->drupal_entity);
   $out[] = array('Salesforce type', $map->salesforce);
 
   // Read the number of existing linked entries
@@ -176,7 +176,7 @@ function drush_sf_import_sf_fieldmap($fieldmap_key = NULL) {
   drush_print("\nMap information:");
   $out = array(array('Salesforce', '', 'Drupal'));
   /*
-   $dr_def = salesforce_api_fieldmap_objects_load('drupal', $map->drupal);
+   $dr_def = salesforce_api_fieldmap_objects_load('drupal', $map->drupal_entity);
    $sf_def = salesforce_api_fieldmap_objects_load('salesforce', $map->salesforce);
    */
   foreach ($map->fields as $sf_fieldname => $dr_fieldname) {
@@ -261,7 +261,7 @@ function drush_sf_import($fieldmap_key) {
     drush_die("Could not find import function for type " . $type);
   }
 
-  $drupal_object = salesforce_api_fieldmap_objects_load('drupal', $map->drupal);
+  $drupal_object = salesforce_api_fieldmap_objects_load('drupal', $map->drupal_entity);
   if ($count == -1) {
     $count = count($query->records) - $start;
   }
diff --git a/sf_prematch/sf_prematch.main.inc b/sf_prematch/sf_prematch.main.inc
index c6bd0f1..1f2cd8d 100644
--- a/sf_prematch/sf_prematch.main.inc
+++ b/sf_prematch/sf_prematch.main.inc
@@ -16,7 +16,7 @@
  * @return string sfid
  */
 function sf_prematch_export($entity_name, $bundle_name, $drupal_object, $map, $match_by) {
-  if (empty($drupal_object) || empty($map->drupal) || empty($match_by)) {
+  if (empty($drupal_object) || empty($map->drupal_entity) || empty($match_by)) {
     return;
   }
   // Get information to allow using handlers to get values of Drupal fields.
@@ -173,7 +173,7 @@ function sf_prematch_import($entity_name, $bundle_name, $object, $map, $match_by
     case "node":
       $id_name = "nid";
       $table_name = "node";
-      $content_type = str_replace("node_", "", $map->drupal);
+      $content_type = str_replace("node_", "", $map->drupal_entity);
       $schema = drupal_get_schema($table_name);
       $fields_table_name = 'content_type_' . $content_type;
       $fields_schema = drupal_get_schema($fields_table_name);
diff --git a/sf_queue/sf_queue.module b/sf_queue/sf_queue.module
index 013975a..7fd5be2 100644
--- a/sf_queue/sf_queue.module
+++ b/sf_queue/sf_queue.module
@@ -121,7 +121,7 @@ function sf_queue_enqueue($op, $sf_object, $map, $oid) {
     'attempts' => 0,
     'created' => REQUEST_TIME,
     'sfid' => empty($sf_object->Id) ? '' : $sf_object->Id, // will be blank on create
-    'drupal_type' => $map->drupal,
+    'drupal_type' => $map->drupal_entity,
     'sf_type' => $map->salesforce,
     'name' => md5(microtime()),
     'fieldmap_name' => $map->name,
@@ -136,7 +136,7 @@ function sf_queue_enqueue($op, $sf_object, $map, $oid) {
   // update the queue by merging the two records instead of appending to it.
   if ($existing = db_fetch_array(db_query('SELECT oid
       FROM {salesforce_export_queue}
-      WHERE drupal_type = :drupal_type AND fieldmap_name = :fieldmap_name AND oid = :oid', array(':drupal_type' => $map->drupal, ':fieldmap_name' => $map->name, ':oid' => $oid)))) {
+      WHERE drupal_type = :drupal_type AND fieldmap_name = :fieldmap_name AND oid = :oid', array(':drupal_type' => $map->drupal_entity, ':fieldmap_name' => $map->name, ':oid' => $oid)))) {
     $update = 'oid';
     $object->oid = $existing['oid'];
   }
@@ -146,7 +146,7 @@ function sf_queue_enqueue($op, $sf_object, $map, $oid) {
   // error but don't prevent the export.
   if (drupal_write_record('salesforce_export_queue', $object, $update)) {
     if (user_access('administer salesforce')) {
-      drupal_set_message(t('Drupal !type queued for Salesforce export.', array('!type' => $map->drupal)));
+      drupal_set_message(t('Drupal !type queued for Salesforce export.', array('!type' => $map->drupal_entity)));
     }
     return FALSE;
   }
-- 
1.7.9.5

