diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install index 7649795..c720652 100644 --- a/modules/taxonomy/taxonomy.install +++ b/modules/taxonomy/taxonomy.install @@ -939,7 +939,7 @@ function taxonomy_update_7011(&$sandbox) { */ /** - * Add unpublished nodes to the taxonomy index table. + * Add entity_revision_is_default nodes to the taxonomy index table. */ function taxonomy_update_7012(&$sandbox) { if (!isset($sandbox['total'])) { @@ -958,12 +958,26 @@ function taxonomy_update_7012(&$sandbox) { // Build the taxonomy index for each node. foreach ($nids as $nid) { $node = node_load($nid); - taxonomy_build_node_index($node); + $isDefaultRevision = $node->status; + $isOriginal = FALSE; + //Check for node translation that is original translation, not a second or third or fourth node translation. + //Otherwise if is entity translation or not translated is ok. + if ($node->tnid == 0 || $node->tnid == $nid) { + $isOriginal = TRUE; + } + if (module_exists('entity')) { + $entity_type = 'node'; + $entity = entity_load($entity_type, array($node->nid)); + $isDefaultRevision = (int) entity_revision_is_default($entity_type, $entity); + } + if($isDefaultRevision && $isOriginal) { + taxonomy_build_node_index($node); + } $sandbox['last'] = $node->nid; } $sandbox['count'] += $batch_size; } - // Finish after all the unpublished nodes have been processed. + // Finish after all the unpublished and entity_revision_is_default nodes have been processed. if ($sandbox['count'] < $sandbox['total']) { $sandbox['#finished'] = FALSE; } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index f4dd98a..7600fbb 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -1940,13 +1940,21 @@ function taxonomy_build_node_index($node) { } } $isDefaultRevision = $status; + $isOriginal = TRUE; if (module_exists('entity')) { $entity_type = 'node'; $entity = entity_load($entity_type, array($node->nid)); $isDefaultRevision = (int) entity_revision_is_default($entity_type, $entity); + //Check for node translation that is original, not a second or third or fourth node translation. + //Otherwise if is entity translation or not translated is ok. + if ($node->tnid == 0 || $node->tnid == $nid) { + $isOriginal = TRUE; + } else { + $isOriginal = FALSE; + } } // We only maintain the taxonomy index for the default node revision. - if ($isDefaultRevision) { + if ($isDefaultRevision && $isOriginal) { // Collect a unique list of all the term IDs from all node fields. $tid_all = array(); foreach (field_info_instances('node', $node->type) as $instance) {