--- /home/JOlstad/public_html/wet/sites/all/modules/drupal_7_port_of_money_cck_field/money.module	2012-07-31 15:30:03.000000000 -0400
+++ money.module	2012-08-21 15:50:49.000000000 -0400
@@ -450,3 +450,92 @@
 function money_field_widget_error($element, $error, $form, &$form_state) {
   form_error($element, $error['message']);
 }
+
+
+/**
+ * Implementation of hook_feeds_processor_targets_alter().
+ * added by Joseph.Olstad aug 20, 2012
+ * @see FeedsNodeProcessor::getMappingTargets().
+ */
+
+function money_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
+  foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
+    $info = field_info_field($name);
+    if ($info['type'] == 'money') {
+      $targets[$name . ":amount"] = array(
+        'name' => $instance['label'] . ': Amount',
+        'callback' => 'money_feeds_set_target',
+        'description' => t('The price amount for the @name field.', array('@name' => $instance['label'])),
+        'real_target' => $name,
+      );
+      $targets[$name . ":currency_code"] = array(
+        'name' => $instance['label'] . ': Currency',
+        'callback' => 'money_feeds_set_target',
+        'description' => t('The currency for the @name field.', array('@name' => $instance['label'])),
+        'real_target' => $name,
+      );
+    }
+  }
+
+}
+
+
+/**
+ * ajouté 20 août, 2012 par Joseph Olstad
+ * 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 money_feeds_set_target($node, $entity, $target, $value) {
+
+/* copied section below from commerce_price_feeds_set_target
+ * http://api.drupalcommerce.org/api/Drupal%20Commerce/sites!all!modules!commerce_feeds!mappers!commerce_price.inc/function/_commerce_price_feeds_processor_targets_alter/DC
+ */
+  if (!isset($value)) {
+    return;
+  }
+
+  // Handle non-multiple value fields.
+  if (!is_array($value)) {
+    $value = array($value);
+  }
+
+  // Get field information.
+  list($field_name, $sub_field) = explode(':', $target);
+  $info = field_info_field($field_name);
+
+  $field = isset($entity->$field_name) ? $entity->$field_name : array();
+
+  // set the default currency 
+  $currency = "CAD"; //hard coding to Canadian Dollars, TODO: please fix this 
+     
+  // Iterate over all values.
+  foreach ($value as $i => $v) {
+    if (!is_array($v) && !is_object($v)) {
+      // puts the default currency, TODO: revise this 
+      $field[LANGUAGE_NONE][$i]['currency'] = $currency;
+ /* 
+  * TODO: internationalize this field save instead of using LANGUAGE_NONE 
+  */
+      if ($sub_field == 'amount') {
+        $field[LANGUAGE_NONE][$i]['amount'] = (!empty($v) && is_numeric($v)) ? trim($v) : 0;
+      }
+      elseif ($sub_field == 'currency') {
+        $field[LANGUAGE_NONE][$i]['currency'] = $v; 
+        /*
+         * TODO: internationalize this field save instead of using LANGUAGE_NONE
+         */
+
+      }
+    }
+    if ($info['cardinality'] == 1) {
+      break;
+    }
+  } 
+  $entity->{$field_name} = $field;
+
+//end of copied section (from commerce_price_feeds_set_target but modified for money)
+}
+
