? 840626-1_support_multiple.patch
? 840626-2_support_multiple.patch
? libraries/simplepie.inc
Index: mappers/content.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/mappers/content.inc,v
retrieving revision 1.5
diff -u -p -r1.5 content.inc
--- mappers/content.inc	16 May 2010 21:15:53 -0000	1.5
+++ mappers/content.inc	29 Jun 2010 22:43:26 -0000
@@ -37,9 +37,8 @@ function content_feeds_node_processor_ta
  * user has decided to map to and $value contains the value of the feed item
  * element the user has picked as a source.
  */
-function content_feeds_set_target($node, $target, $value) {
-
-  $field = isset($node->$target) ? $node->$target : array();
+function content_feeds_set_target($node, $target, $value, $reset = FALSE) {
+  $field = $reset || !is_array($node->$target) ? array() : $node->$target;
 
   // Handle multiple value fields.
   if (is_array($value)) {
Index: mappers/filefield.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/mappers/filefield.inc,v
retrieving revision 1.4
diff -u -p -r1.4 filefield.inc
--- mappers/filefield.inc	29 Mar 2010 02:55:50 -0000	1.4
+++ mappers/filefield.inc	29 Jun 2010 22:43:26 -0000
@@ -42,7 +42,7 @@ function filefield_feeds_node_processor_
  *
  * @todo: should we support $object->url again?
  */
-function filefield_feeds_set_target($node, $field_name, $value) {
+function filefield_feeds_set_target($node, $field_name, $value, $reset = FALSE) {
   // Normalize $value, create an array of FeedsEnclosures of it.
   $enclosures = array();
   if (!is_array($value)) {
@@ -58,7 +58,7 @@ function filefield_feeds_set_target($nod
   }
 
   // Map enclosures.
-  $items = isset($node->$field_name) ? $node->$field_name : array();
+  $items = $reset || !is_array($node->$field_name) ? array() : $node->$field_name;
   foreach ($enclosures as $enclosure) {
     if ($file = $enclosure->getFile()) {
       $field = content_fields($field_name, $node->type);
Index: mappers/link.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/mappers/link.inc,v
retrieving revision 1.1
diff -u -p -r1.1 link.inc
--- mappers/link.inc	19 Jun 2010 16:53:34 -0000	1.1
+++ mappers/link.inc	29 Jun 2010 22:43:26 -0000
@@ -47,7 +47,7 @@ function link_feeds_node_processor_targe
  * @param $value
  *   The value to assign to the CCK field.
  */
-function link_feeds_set_target($node, $target, $value) {
+function link_feeds_set_target($node, $target, $value, $reset = FALSE) {
   if (!empty($value)) {
     static $defaults = array();
     list($field_name, $sub_field) = split(':', $target);
@@ -59,7 +59,7 @@ function link_feeds_set_target($node, $t
         $defaults[$node->type][$field_name]['title'] = $field['title_value'];
       }
     }
-    $field_data = isset($node->$field_name) ? $node->$field_name : array();
+    $field_data = $reset || is_array($node->$field_name) ? array() : $node->$field_name;
 
     if (!is_array($value)) {
       $value = array($value);
Index: mappers/taxonomy.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/mappers/taxonomy.inc,v
retrieving revision 1.1
diff -u -p -r1.1 taxonomy.inc
--- mappers/taxonomy.inc	5 Dec 2009 01:38:27 -0000	1.1
+++ mappers/taxonomy.inc	29 Jun 2010 22:43:26 -0000
@@ -39,7 +39,7 @@ function taxonomy_feeds_node_processor_t
  * Add the given terms to the node object so the taxonomy module can add them
  * on node_save().
  */
-function taxonomy_feeds_set_target(&$node, $key, $terms) {
+function taxonomy_feeds_set_target(&$node, $key, $terms, $reset = TRUE) {
 
   // Return if there are no terms.
   if (empty($terms)) {
@@ -50,6 +50,15 @@ function taxonomy_feeds_set_target(&$nod
   $vocab_id = (int) str_replace('taxonomy:', '', $key);
   $vocab = taxonomy_vocabulary_load($vocab_id);
 
+  // Remove target vocabulary terms from node before adding new ones.
+  if ($reset) {
+    foreach ($node->taxonomy as $term) {
+      if ($term->vid == $vocab->vid) {
+        unset($node->taxonomy[$term->tid]);
+      }
+    }
+  }
+
   // Cast a given single string to an array so we can use it.
   if (!is_array($terms)) {
     $terms = array($terms);
Index: plugins/FeedsProcessor.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsProcessor.inc,v
retrieving revision 1.11
diff -u -p -r1.11 FeedsProcessor.inc
--- plugins/FeedsProcessor.inc	19 Jun 2010 15:57:13 -0000	1.11
+++ plugins/FeedsProcessor.inc	29 Jun 2010 22:43:26 -0000
@@ -104,12 +104,14 @@ abstract class FeedsProcessor extends Fe
     If the mapping specifies a callback method, use the callback instead of
     setTargetElement().
     */
+    $called = array();
     foreach ($this->config['mappings'] as $mapping) {
       $value = $parser->getSourceElement($source_item, $mapping['source']);
 
       if (is_array($targets[$this->id][$mapping['target']]) && isset($targets[$this->id][$mapping['target']]['callback']) && function_exists($targets[$this->id][$mapping['target']]['callback'])) {
         $callback = $targets[$this->id][$mapping['target']]['callback'];
-        $callback($target_item, $mapping['target'], $value);
+        $callback($target_item, $mapping['target'], $value, $called[$mapping['target']] ? TRUE : FALSE);
+        $called[$mapping['target']] = TRUE;
       }
       else {
         $this->setTargetElement($target_item, $mapping['target'], $value);
