Index: mappers/phone.inc
===================================================================
RCS file: mappers/phone.inc
diff -N mappers/phone.inc
--- /dev/null	2011-05-24 17:16:59.000000000 -0400
+++ mappers/phone.inc	2011-05-24 16:48:53.000000000 -0400
@@ -0,0 +1,59 @@
+<?php
+// $Id$ eneko1907
+
+/**
+ * @file
+ * On behalf implementation of Feeds mapping API for phone.module (CCK).
+ */
+
+/**
+ * Implementation of hook_feeds_node_processor_targets_alter().
+ *
+ * @see FeedsNodeProcessor::getMappingTargets().
+ */
+function phone_feeds_node_processor_targets_alter(&$targets, $content_type) {
+  $info = content_types($content_type);
+  $fields = array();
+  if (isset($info['fields']) && count($info['fields'])) {
+    foreach ($info['fields'] as $field_name => $field) {
+      if (in_array($field['type'], array('fr_phone',
+                        'be_phone',
+                        'it_phone',
+                        'el_phone',      
+                        'ch_phone',
+                        'ca_phone',
+                        'cr_phone',
+                        'pa_phone',
+                        'gb_phone',
+                        'ru_phone',
+                        'ua_phone',
+                        'es_phone',
+                        'au_phone',
+                        'cs_phone',
+                        'hu_phone',
+                        'pl_phone',
+                        'nl_phone',
+                        'se_phone',
+                        'za_phone',
+                        'il_phone',
+                        'nz_phone',
+                        'br_phone',
+                        'cl_phone',
+                        'cn_phone',      
+                        'hk_phone',
+                        'mo_phone',
+                        'ph_phone',
+                        'sg_phone',
+                        'jo_phone',
+                        'eg_phone',
+                        'pk_phone',
+                        'int_phone''))) {
+        $fields[$field_name] = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
+      }
+    }
+  }
+  foreach ($fields as $k => $name) {
+    $targets[$k] = array(
+      'name' => $name,
+      'callback' => 'phone_feeds_set_target',
+      'description' => t('The CCK Phone !name field of the node.', array('!name' => $name)),
+    );
+  }
+}
+
+/**
+ * Callback for mapping. Here is where the actual mapping happens.
+ *
+ * When the callback is invoked, $target contains the name of the field the
+ * user has decided to map to and $value contains the value of the feed item
+ * element the user has picked as a source.
+ */
+function phone_feeds_set_target($node, $target, $value) {
+
+  $field = isset($node->$target) ? $node->$target : array();
+
+  // Handle multiple value fields.
+  if (is_array($value)) {
+    $i = 0;
+    foreach ($value as $v) {
+      if (!is_array($v) && !is_object($v)) {
+        $field[$i]['value'] = $v;
+      }
+      $i++;
+    }
+  }
+  else {
+    $field[0]['value'] = $value;
+  }
+
+  $node->$target = $field;
+}
Index: tests/feeds_mapper_phone.test
===================================================================
RCS file: tests/feeds_mapper_phone.test
diff -N tests/feeds_mapper_phone.test
--- /dev/null	2011-05-13 17:16:59.000000000 -0400
+++ tests/feeds_mapper_phone.test	2011-05-13 17:02:47.000000000 -0400
@@ -0,0 +1,95 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Test case for simple CCK field mapper mappers/phone.inc.
+ */
+
+require_once(drupal_get_path('module', 'feeds') . '/tests/feeds_mapper_test.inc');
+
+/**
+ * Class for testing Feeds <em>phone</em> mapper.
+ */
+class FeedsMapperPhoneTestCase extends FeedsMapperTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => t('Mapper: Phone'),
+      'description' => t('Test Feeds Mapper support for Phone CCK fields. <strong>Requires CCK module and Phone module</strong>.'),
+      'group' => t('Feeds'),
+    );
+  }
+
+  /**
+   * Set up the test.
+   */
+  function setUp() {
+    // Call parent setup with required modules.
+    parent::setUp('feeds', 'feeds_ui', 'ctools', 'content', 'phone');
+
+    // Create user and login.
+    $this->drupalLogin($this->drupalCreateUser(
+        array(
+          'administer content types',
+          'administer feeds',
+          'administer nodes',
+          'administer site configuration'
+        )
+    ));
+  }
+
+  /**
+   * Basic test loading a doulbe entry CSV file.
+   */
+  function test() {
+
+  	// Create content type.
+  	$typename = $this->createContentType(NULL, array(
+      'phone' => 'phone',
+    ));
+
+    // Create and configure importer.
+    $this->createImporterConfiguration('Phone CSV', 'csv');
+    $this->setSettings('csv', NULL, array('content_type' => '','import_period' => FEEDS_SCHEDULE_NEVER,));
+    $this->setPlugin('csv', 'FeedsFileFetcher');
+    $this->setPlugin('csv', 'FeedsCSVParser');
+    $this->setSettings('csv', 'FeedsNodeProcessor', array('content_type' => $typename));
+    $this->addMappings('csv', array(
+      array(
+        'source' => 'title',
+        'target' => 'title',
+      ),
+      array(
+        'source' => 'created',
+        'target' => 'created',
+      ),
+      array(
+        'source' => 'body',
+        'target' => 'body',
+      ),
+      array(
+        'source' => 'phone',
+        'target' => 'field_phone',
+      ),
+    ));
+
+    // Import CSV file.
+    $this->importFile('csv', $this->absolutePath() .'/tests/feeds/phone.csv');
+    $this->assertText('Created 2 '. $typename .' nodes.');
+
+    // Check the two imported files.
+    $this->drupalGet('node/1/edit');
+    $this->assertCCKFieldValue('phone', '(505) 555-1212');
+
+    $this->drupalGet('node/2/edit');
+    $this->assertCCKFieldValue('phone', '(212) 555-1212');
+  }
+
+  /**
+   * Override parent::getFormFieldsNames().
+   */
+  protected function getFormFieldsNames($field_name, $index) {
+    return array("field_{$field_name}[{$index}][value]");
+  }
+}
Index: tests/feeds/phone.csv
===================================================================
RCS file: tests/feeds/phone.csv
diff -N tests/feeds/phone.csv
--- /dev/null	2011-05-13 17:16:59.000000000 -0400
+++ tests/feeds/phone.csv	2010-05-13 16:48:53.000000000 -0400
@@ -0,0 +1,3 @@
+"guid","title","created","phone","body"
+1,"Lorem ipsum",1251936720,"(505) 277-2211","Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."
+2,"Ut wisi enim ad minim veniam",1251936720,"(505) 222-1111","Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat."

