This error appears on node save as reported here #622516: Node Count not updating on comment #13 (http://drupal.org/node/622516#comment-2286728).

Comments

fred0’s picture

Thanks for the differentiation. I'd posted the node save error in #13 on the other thread because it seemed to be related to comment #5 there.

indytechcook’s picture

It's no problem. With the size and activities of this issues queue I do my best to keep it straight.

Please give me the steps to reproduce this error. It does not occur for me when I save a node. Make sure you are testing based upon the dev version.

fred0’s picture

Ok, I seemed to have narrowed this down to a conflict with the CCk module Content Taxonomy.
If my content type has a Content Taxonomy field set and Taxonomy Menu module is enabled, I get the error.
This happens even if the taxonomy in question isn't set to use Taxonomy Menu, just having the core module enabled is enough.
The error is a fairly new thing. The last dev of Content Taxonomy was in Sept and I'd been using that version with Taxonomy Menu for a while without error. Not to say that the problem is fully Taxonomy Menu but, of the two, it is the one that changed more recently.

indytechcook’s picture

Status: Active » Fixed

Thanks, that's what I needed. I found the bug and fixed it. http://drupal.org/cvs?commit=293340 Please test with the dev created after this post.

indytechcook’s picture

Title: Error on node save » Error on node save when using Content Taxonomy

Updated Title

hass’s picture

I'm not using content taxonomy... :-(

hass’s picture

Status: Fixed » Active

This bug seems not fixed if fixed specific for Content Taxonomy only. What is _taxonomy_menu_get_node_terms() for? The function is not required at all as the term id's of a node are already inside $node->taxonomy = array(). The function is also not used elsewhere. KISS...

_taxonomy_menu_nodeadpi_helper() looks like a typo ("nodeadpi") or intentionally wrong written for not colliding with the nodeapi hook? It may be better to rename the function.

Here is the list of modules I have enabled:
admin_menu
advanced_help
cck
devel
lightbox2
link
nodewords
page_title (not configured yet)
pathauto
site_map
tagadelic
taxonomy_breadcrumb
taxonomy_menu
taxonomy_title
term_fields
token
vertical_tabs
views
wysiwyg
xmlsitemap 2.x

I can only guess now - but it could be related to multiple terms per node... need to investigate if this is possible. I know from debugging that my $node->taxonomy array only contains something like array(0 => 123, 1 => 234, 2 => 345).

This is the way how I fill the node's taxonomy programmatically (the taxonomy can be a nested tree) and $tid is always the deepest nested tid:

 $terms = taxonomy_get_parents_all($tid);
 $node->taxonomy = array();
 foreach ($terms as $term) {
   $node->taxonomy[] = $term->tid;
 }
indytechcook’s picture

Status: Active » Fixed

Hello hass,

This bug seems not fixed if fixed specific for Content Taxonomy only. What is _taxonomy_menu_get_node_terms() for? The function is not required at all as the term id's of a node are already inside $node->taxonomy = array(). The function is also not used elsewhere. KISS...

Did you read the comment above the function call?

//we use this direct table pull to avoid the cache and because
//free tags are not formatted in a matter where extracting the
//tid's is easy
$terms_new = _taxonomy_menu_get_node_terms($node->nid);

In both the presave and update case the node->taxonomy array will not necessarily have the correct information needed to update all of the correct menu items. That part of code is the result of alot of time and testing to make it work the best to all situations. Using the taxonomy function ran into issue where the variables were statically cached with old values before table updates and I needed the changes.

It's also important to note the the node->taxonomy array is different in different situations. It's different for free taging, It's also different between the update and add node scenarios.

_taxonomy_menu_nodeadpi_helper() looks like a typo ("nodeadpi") or intentionally wrong written for not colliding with the nodeapi hook? It may be better to rename the function.

This really doesn't have ANY effect on how the code operates, but I agree that is does look nicer to have it spelled right :)

If you are not using content_taxonomy and you error message does not match what fred0 has then it sounds like a different issue. Please log a new issue if the message does not match below and let me know the exact setup in taxonomy menu and steps to reproduce.

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key,3)' at line 1 query: SELECT vid FROM term_data WHERE tid in (key,3) in /var/www/vhosts/hughjaas.com/subdomains/btp/httpdocs/sites/default/modules/taxonomy_menu/taxonomy_menu.database.inc on line 162.

fred0’s picture

Just reporting in that the latest dev fixes my error. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.