From 1eb194a5e68552d209e429e136edfae7eadc2fce Mon Sep 17 00:00:00 2001
From: Darren Oh <darren@oh.name>
Date: Sun, 21 Feb 2016 00:25:40 -0500
Subject: [PATCH] Issue #2651420 by Darren Oh: Fixed target callback overrides.

Removes overrides not related to Excel data formats.
---
 feeds_xls.module | 83 +-------------------------------------------------------
 1 file changed, 1 insertion(+), 82 deletions(-)

diff --git a/feeds_xls.module b/feeds_xls.module
index 0cbd4d4..15a28ec 100644
--- a/feeds_xls.module
+++ b/feeds_xls.module
@@ -128,34 +128,13 @@ function feeds_xls_get_or_generate_feeds_item_entry($entity_type, $entity_id, $i
 /**
  * Implements hook_feeds_processor_targets_alter().
  * 
- * We alter the numeric field types so that fields that are set up with values
- * like:
- * 
- * 1|Something
- * 2|Rocking
- * 3|Banana
- * 
- * allow the entry of the text "Something", or "Rocking" instead of "1" or "2".
- * 
  * We alter date field types, so that "days since epoch" values can be imported
  * without changing the format in Excel
  */
 function feeds_xls_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name){
-  $numeric_types = array(
-    'list_integer',
-    'list_float',
-    'list_boolean',
-    'number_integer',
-    'number_decimal',
-    'number_float'
-  );
   foreach(field_info_instances($entity_type, $bundle_name) as $name => $instance){
     $info = field_info_field($name);
-    if(in_array($info['type'], $numeric_types)){
-      $targets[$name]['callback'] = 'feeds_xls_feeds_set_target_numeric';
-    }elseif($info['type'] == 'list_text'){
-      $targets[$name]['callback'] = 'feeds_xls_feeds_set_target_list_text';
-    }elseif(in_array($info['type'], array(
+    if(in_array($info['type'], array(
       'date',
       'datestamp',
       'datetime'
@@ -198,66 +177,6 @@ function feeds_xls_feeds_set_target_date($source, $entity, $target, $value){
 }
 
 /**
- * Callback for mapping text list fields.
- * 
- * Maps from a value to a key.
- * 
- */
-function feeds_xls_feeds_set_target_list_text($source, $entity, $target, $value){
-  if(!is_array($value)){
-    $value = array(
-      $value
-    );
-  }
-  $field = field_info_field($target);
-  foreach($value as $k => $v){
-    // We load the field and try to do the mapping.
-    if(!empty($field['settings']['allowed_values'])){
-      $key = array_search($v, $field['settings']['allowed_values']);
-    }elseif(!empty($field['settings']['allowed_values_function']) && function_exists($field['settings']['allowed_values_function'])){
-      $key = array_search($v, $field['settings']['allowed_values_function']($field));
-    }else{
-      $key = $v;
-    }
-    if($key !== FALSE){
-      $value[$k] = $key;
-    }else{
-      unset($value[$k]);
-    }
-  }
-  text_feeds_set_target($source, $entity, $target, $value, array());
-}
-
-/**
- * Callback for mapping numerics.
- *
- * Ensure that $value is a numeric to avoid database errors.  This will also map
- * from a value to a key for list fields.
- */
-function feeds_xls_feeds_set_target_numeric($source, $entity, $target, $value){
-  if(!is_array($value)){
-    $value = array(
-      $value
-    );
-  }
-  foreach($value as $k => $v){
-    if(!is_numeric($v)){
-      // We load the field and try to do the mapping.
-      $field = field_info_field($target);
-      if(isset($field['settings']['allowed_values'])){
-        $key = array_search($v, $field['settings']['allowed_values']);
-        if($field && is_numeric($key)){
-          $value[$k] = $key;
-        }else{
-          unset($value[$k]);
-        }
-      }
-    }
-  }
-  number_feeds_set_target($source, $entity, $target, $value, FALSE);
-}
-
-/**
  * Overlay doesn't handle the file download path well.
  */
 function feeds_xls_admin_paths(){
-- 
2.5.4 (Apple Git-61)