Posted by mikeryan on January 11, 2009 at 6:40pm
| Project: | Primary Term |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | rmjiv |
| Status: | reviewed & tested by the community |
Issue Summary
Not sure why this doesn't happen when saving a node edit form, but with a programmatic node_save() of a node with a primary term assigned, duplicate key warnings on term_node are generated. As the comments say:
// taxonomy_node_save() allows $node->taxonomy to contain tids,
// term objects, or arrays of tids (keyed by vocabulary). So,
// we can add the PT tid to the end of the array.But, the code is only handling raw tids and arrays, not objects. The attached patch addresses this.
| Attachment | Size |
|---|---|
| primary_term.module.patch | 435 bytes |
Comments
#1
#2
+1, I know this stretch of code has some other patches pending on that same bit of logic, so I'll review and combine with this in mind.
#3
This patch and the one in http://drupal.org/node/604076 are essentially duplicates. They cover slightly different cases for the same problem. Here is a patch for the code I've been running for the past year on our site. It should cover both cases.
#4
Thanks rmjiv,
This patch worked for me.
#5
Committed mikeryan's patch to -dev. Both of the two submitted patches did the job; mikeryan's was easier to read for future maintainers.
http://drupal.org/cvs?commit=435604
#6
Automatically closed -- issue fixed for 2 weeks with no activity.
#7
Unfortunately mikeryan's patch didn't have a fix that is required for Hierarchical Select support. HS stomps on the keys in the $node->taxonomy array. The values are still there, but it's not keyed by tid anymore. Attached patch works around this.
#8
worked fine for me. here is a formatted patch to make the mantainers' life easier.
see http://drupal.org/node/1054616 for more on this.