X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FMenu.pm;h=6bbcffb9c8af8adbfc42883522e3298b47a2e5cd;hb=c9d5cc7f38af8db81fcfd11fac6cda62935d41c3;hp=ccfc32c969213c5de5d99857969c7366e5d36772;hpb=af0085b83ecb257679c8c64324521f9515ae76b8;p=kivitendo-erp.git 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 = { };