Hello,
Submit handler for adding or removing a parent for a term will load the term, based on $form_state values, run a query to update hierarchy table and after that it calls taxonomy_term_save($term), using the non-updated $term object.
That means we'll not have the new parents ids in the taxonomy_term_presave hook and for remove handler, the parents can't be removed, because even if db_delete will update the table, the taxonomy_term_save function will put parents back.
The key part is to replace the db_insert()/db_delete() part with populating the $term object with new parents ids.
Comments
Comment #0.0
cracu commentedupdated message
Comment #0.1
cracu commentedupdate message.
Comment #1
cracu commentedI propose the attached patch.
Comment #2
cracu commentedComment #2.0
cracu commentednoticed also a bug.
Comment #2.1
cracu commentedUpdated message
Comment #3
cracu commentedUpdating status to review the patch.
Comment #4
mfernea commentedI confirm that the patch at #1 works.
Comment #5
mh86 commentedThanks for the patch and review!
Committed #1.
Comment #6.0
(not verified) commentedUpdate message.