? 836878-11_support_complex_terms.patch
? 836878_7.patch
? 868740-10_exportable_taxonomy.patch
Index: data_taxonomy/data_taxonomy.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/data/data_taxonomy/Attic/data_taxonomy.module,v
retrieving revision 1.1.2.31
diff -u -p -r1.1.2.31 data_taxonomy.module
--- data_taxonomy/data_taxonomy.module	8 Sep 2010 17:02:54 -0000	1.1.2.31
+++ data_taxonomy/data_taxonomy.module	8 Sep 2010 17:12:25 -0000
@@ -118,6 +118,15 @@ function data_taxonomy_data_update($reco
  */
 function _data_taxonomy_save_terms($table_name, $id, $terms, $vocabulary) {
   foreach ($terms as $term) {
+    if ($vocabulary->tags) {
+      if (is_object($term)) {
+        $term = (array)$term;
+      }
+      if (is_string($term) || is_array($term)) {
+        $term = data_taxonomy_save_term($term, $vocabulary->vid);
+        $term = $term['tid'];
+      }
+    }
     if (is_numeric($term)) {
       db_query("INSERT INTO {data_taxonomy}(id, data_table_name, tid) VALUES(%d, '%s', %d)", $id, $table_name, $term);
     }
@@ -262,15 +271,23 @@ function data_taxonomy_save_relations($v
  * @return
  *   A taxonomy term array.
  */
-function data_taxonomy_save_term($name, $vid) {
-  foreach (taxonomy_get_term_by_name($name) as $possibility) {
-    if ($possibility->vid == $vid) {
-      $term = $possibility;
-      break;
-    }
+function data_taxonomy_save_term($term, $vid) {
+  if (is_string($term)) {
+    $term = array(
+      'vid' => $vid,
+      'name' => $name,
+    );
   }
-  if (!$term) {
-    $term = array('vid' => $vid, 'name' => $name);
+  elseif (!is_array($term)) {
+    return;
+  }
+  if (!isset($term['tid']) || $term['vid'] != $vid) {
+    foreach (taxonomy_get_term_by_name($term['name']) as $possibility) {
+      if ($possibility->vid == $vid) {
+        $term = (array)$possibility;
+        break;
+      }
+    }
   }
   taxonomy_save_term($term);
   return $term;
