There is an inconsistency in defining start of order_by value. In _nodehierarchy_get_next_child_order order_by is starting from -1 (actually from 0 because its returning order_by+1)
function _nodehierarchy_get_next_child_order($parent_nid) {
$order_by = -1;
...
return $order_by + 1;
}and in _nodehierarchy_normalize_child_order order_by is starting from 1
$i = 1;
while ($hierarchy = db_fetch_object($result)) {
$hierarchy->order_by = $i;
$i++;So when creating children for the first time, first child will have order_by 0, but later when you for example reorder children then first child will have order_by 1. This is not affecting in anyway functionality of nodehierarchy module but if you are using order_by for some other purpose (like i am printing it in template files) sometimes first child has order_by 0 and sometimes 1.
Proposed patch will modify _nodehierarchy_get_next_child_order so order_by will from now always start from 1 - i think its better from 1 and not from 0 because in _nodehierarchy_create_menu there is next line of code that are expecting that order_by goes from 1:
// Editable menu weight range used to start at -10.
$item['weight'] = $node->order_by - 11;| Comment | File | Size | Author |
|---|---|---|---|
| nodehierarchy_order_by.patch | 803 bytes | pivica |
Comments
Comment #1
pivica commentedComment #2
markhalliwellCopy & Pasted: This issue pertains to the 6.x-1.x branch which is now legacy and is over two years old. If this issue is not applicable anymore, please consider closing it. Otherwise, please update this issue appropriately. Will be closed in two weeks if no response.