Auftrags-Controller: Zahlungs- und Lieferbedingungen
[kivitendo-erp.git] / SL / Menu.pm
index ccfc32c..6bbcffb 100644 (file)
@@ -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 = { };