mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Fixed missing tree nodes for some tree structures
There were two cases that led to missing tree nodes: * If one node at the same depth as another node had a higher primary key ID but showed up in the rows before, the lower primary key ID node will go missing. * If an unmatching row for the current node in moveRowsToTreeNodes appeared between a matching row, the matching row would never be reached and would not be added to the tree.
This commit is contained in:
@@ -3456,10 +3456,7 @@ class e_tree_model extends e_front_model
|
|||||||
$rowParentID = (int) $row[$sort_parent];
|
$rowParentID = (int) $row[$sort_parent];
|
||||||
|
|
||||||
// Note: This optimization only works if the SQL query executed was ordered by the sort parent.
|
// Note: This optimization only works if the SQL query executed was ordered by the sort parent.
|
||||||
if($nodeID !== $rowParentID)
|
if($rowParentID > $nodeID) break;
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$node['_children'][] = &$row;
|
$node['_children'][] = &$row;
|
||||||
unset($rows[$key]);
|
unset($rows[$key]);
|
||||||
@@ -3620,7 +3617,7 @@ class e_tree_model extends e_front_model
|
|||||||
return "";
|
return "";
|
||||||
}, $db_query)
|
}, $db_query)
|
||||||
// Optimization goes with e_tree_model::moveRowsToTreeNodes()
|
// Optimization goes with e_tree_model::moveRowsToTreeNodes()
|
||||||
. " ORDER BY " . $this->getParam('sort_parent');
|
. " ORDER BY " . $this->getParam('sort_parent') . "," . $this->getParam('primary_field');
|
||||||
$this->setParam('db_query', $db_query);
|
$this->setParam('db_query', $db_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user