The content taxonomy field mapper can only ADD terms to content taxonomy fields. This is fine if you are importing new nodes, but if you are updating nodes, this results in confusing behavior and potentially orphaned taxonomy data on nodes that cannot be fixed via the UI.

Scenario 1 (less serious):

  1. Start with a nodetype that has a content taxonomy field that accepts unlimited values, and also maps terms to the {term_node} table.
  2. Create a node and assign some terms to the content taxonomy field.
  3. Create a CSV Feeds Importer that allows for "updating existing nodes" with a field that maps to the content taxonomy field.
  4. Create a CSV with some terms in the content taxonomy field mapping that don't already exist on the node, and run the importer with it.

Result: the new terms in the source data (ie: CSV column) are added to the terms that already existed on the node. The expected behavior is that they will replace them.

Scenario 2 (more serious):

  1. Start with a nodetype that has a content taxonomy field that accepts a single values, and also maps terms to the {term_node} table.
  2. Create a node and assign a term to the content taxonomy field.
  3. Create a CSV Feeds Importer that allows for "updating existing nodes" with a field that maps to the content taxonomy field.
  4. Create a CSV with a term in the content taxonomy field mapping that isn't already on the node, and run the importer with it.

Result: The new term from the CSV is added to the node's $node->taxonomy array (and added to the {term_node} table), but it is NOT added to the content taxonomy field. This means that the node is associated with that term, but there's no way to know that from the node edit form itself, and no way to fix it through the UI.

See also:
#2073671: Content mapper can only add values
#2073745: Filefield mapper can only add files, not remove

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m.stenta’s picture

Status: Active » Needs review
FileSize
1.15 KB

Patch attached which fixes the issue. It simply initializes the content taxonomy field as an empty array before assigning terms to it.

twistor’s picture

Status: Needs review » Closed (duplicate)
twistor’s picture