When deleting terms from a Hierarchy you can delete a term from the middle and orphan children records in the database.
Steps to reproduce.
1) Create vocabulary with single hierarchy
2) Create term 1
3) Create term 2 with parent of term 1
4) Create term 3 with parent of term 2
5) Delete term 2
Now in the database term 3 still exists, but is labeled with a parent of term 2 even though term 2 no longer exists. This makes it impossible to edit or delete term 3 in the admin screens.
When deleting terms with children all children's parents should get set to the deleted terms parent or if the child has no other parents then the child should be deleted as well.
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedthe proposed resolution sounds OK as long as we tell the user on the Confirmation page exactly what is going to happen.
Comment #2
Jeremy CreditAttribution: Jeremy commentedHere's a patch to implement this, recursively deleting terms and all their children. While testing I realized this has a side affect that probably needs to be resolved. To explain the remaining issue, imagine the following hierarchy:
With this patch, deleting the term "two" will also delete "three" and "3". The term "three" should be deleted, but obviously "3" should not.
Comment #3
Jeremy CreditAttribution: Jeremy commentedOkay, this patch cleans up all orphans and only orphans.
Comment #4
Dries CreditAttribution: Dries commentedI rewrote this patch (the code is a lot shorter now) and committed it to HEAD.
Comment #5
(not verified) CreditAttribution: commented