I wonder if this is actually a core taxonomy issue but I'll post here first only because I found this issue which seems similar to mine:
https://www.drupal.org/node/634270

Strangely enough, the fix in this issue^^ does NOT work. Perhaps it did at one time? Weird.

So I have a master vocab ("Business Categories") which references another vocab ("Services").

Unfortunately, there are duplicate term names within this referenced vocab ("Services").
(Please note: These duplicate term names are by design. Not my design, however... but there are legitimate cases where duplicate term names SHOULD work. "Accessories" for a car vs. "Accessories" for, say, beauty products.)

If I open either a taxonomy-manager term-edit page ("admin/structure/taxonomy_manager/voc/dscat/13024") for the term that references a term in my "Services" vocab or the standard taxonomy page ("taxonomy/term/13024/edit"), the autocomplete field indeed shows the name of the referenced term. (The name in this example is "Accessories" and its tid is 106771.)

It's worth noting that when there are duplicated term names in a referenced vocab, in order to get the form to reference the CORRECT term, one needs to save the term using a feeds import (which is what I've been doing to get around this issue).

Here's the bug:
There are a total of 4 terms called "Accessories" within my referenced vocab (the "Services" vocab). Each term is listed here with its own respective unique tid.
TERM NAME : TID
a) Accessories: 106771
b) Accessories: 107311
c) Accessories: 107981
d) Accessories: 108491

Taxonomy Manager and/or Taxonomy edit form loads, autocomplete field lists "Accessories" and looking at a devel page, the referenced tid is indeed 106771.

If I simply click the 'Save' button even without changing anything, the form submits as it should but the referenced term within the autocomplete field (although showing the correct term name) is actually now referencing the LAST 'Accessories' term (Accessories: 108491).

Seems like the reason this happens is because drupal_explode_tags() matches on term name with no option to match via tid. That seems bad.

Again, currently, the only way to get around this is to save these terms with a custom feeds import that is looking for a tid and not a term name.

This seems like a pretty important issue in terms of data integrity.

Comments

AaronELBorg created an issue. See original summary.

aaronelborg’s picture

Issue summary: View changes

Editing my issue to include the correct culprit:
drupal_explode_tags()

aaronelborg’s picture

Issue summary: View changes
aaronelborg’s picture

Status: Active » Closed (duplicate)

Closing the issue.

I've submitted a core patch.

aaronelborg’s picture