X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/af0085b83ecb257679c8c64324521f9515ae76b8..5dd5e97bc9fe0aee0be2621fe11d48c86be40a5d:/SL/Menu.pm diff --git a/SL/Menu.pm b/SL/Menu.pm index ccfc32c96..6bbcffb9c 100644 --- a/SL/Menu.pm +++ b/SL/Menu.pm @@ -21,7 +21,7 @@ sub new { my $path = File::Spec->catdir('menus', $domain); opendir my $dir, $path or die "can't open $path: $!"; - my @files = sort grep -f "$path/$_", readdir $dir; + my @files = sort grep -f "$path/$_", grep /\.yaml$/, readdir $dir; close $dir; my $nodes = []; @@ -97,13 +97,13 @@ sub build_tree { # first, some sanity check. are all parents valid ids or empty? for my $node ($self->nodes) { next if !exists $node->{parent} || !$node->{parent} || $self->{by_id}->{$node->{id}}; - die "menu: node $node->{id} has non-existant parent $node->{parent}"; + die "menu: node $node->{id} has non-existent parent $node->{parent}"; } my %by_parent; # order them by parent for my $node ($self->nodes) { - push @{ $by_parent{ $node->{parent} } //= [] }, $node; + push @{ $by_parent{ $node->{parent} // '' } //= [] }, $node; } my $tree = { };