Hello there,

I'm using nodehierarchy (1.x) in an i18n context. Nodes are translated and parent points to the translated node. I've a batch script to maintain this integrity.

I may have found a little issue related to i18nsync. When one of the node of the translation set is updated, i18nsync perform field synchronization amongst the whole set (on fields completely unrelated to nodehierarchy) and then calls node_save on each node.

Problem is : in nodehierarchy_insert_node, we rely on $node->old_parent to determine if parent changed (which is not the case). But as we're not regularly editing via it's form, there's no old_parent and the function act as is it was the first time a parent was set. As a result, the "order_by" field is messed up : the node is put at the end of child list.

Quick solve : add "old_parent" in the fields outputed by nodehierarchy_load_node :

@@ -488,6 +488,7 @@
  */
 function nodehierarchy_load_node($node) {
   $additions = db_fetch_array(db_query('SELECT parent, order_by FROM {nodehierarchy} WHERE nid = %d', $node->nid));
+  $additions['old_parent'] = $additions['parent']; 
   return $additions;
 }
 

I'll be glad to receive some feedback about that workaround.

Comments

avpaderno’s picture

Component: Code » Drupal/PHP Code
Issue summary: View changes
Status: Active » Closed (outdated)

I am closing this issue, as Drupal 6 is now not supported.