diff --git a/lib/WebGUI/Persistent/Tree.pm b/lib/WebGUI/Persistent/Tree.pm index 7f48dfa57..3bfdbc011 100644 --- a/lib/WebGUI/Persistent/Tree.pm +++ b/lib/WebGUI/Persistent/Tree.pm @@ -239,7 +239,7 @@ sub getTree { unless (ref($self)) { if ($class->useDummyRoot()) { - $self = $class->dummyRoot(); + $nodes->{0} = $self = $class->dummyRoot(); } if (!defined($maxDepth)) { @@ -306,6 +306,26 @@ sub minimumFields { #------------------------------------------------------------------- +sub name { + my $self = shift; + return $self->keyColumn().':'.$self->get($self->keyColumn()); +} + +#------------------------------------------------------------------- + +# Avoid a bug in Tree::DAG_Node. +# When a new node is created and has no daughters. This sometimes causes +# problems for Tree::DAG_Node::walk_down() + +sub new { + my $class = shift; + my $self = $class->SUPER::new(@_); + $self->{daughters} ||= [] if $self; + return $self; +} + +#------------------------------------------------------------------- + =head2 motherSelfAndSisters( $keyColumnId ) Given the $keyColumnId, this method fetches the related mother and sisters.