X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FMenu.pm;h=42b08de48004d2fd4d6604351764930708c402ae;hb=5428f5f6d9dbced453dcfc113f683ceacee6380a;hp=800f000b22bc0a248b4b7daad741efdc544b861d;hpb=c345944814d217a00b73824747ed34725f311f10;p=kivitendo-erp.git diff --git a/SL/Menu.pm b/SL/Menu.pm index 800f000b2..42b08de48 100644 --- a/SL/Menu.pm +++ b/SL/Menu.pm @@ -119,6 +119,19 @@ sub build_tree { push @{ $by_parent{ $node->{parent} // '' } //= [] }, $node; } + # autovivify order in by_parent, so that numerical sorting for entries without order + # preserves their order and position with respect to entries with order. + for (values %by_parent) { + my $last_order = 0; + for my $node (@$_) { + if (defined $node->{order} && $node->{order} * 1) { + $last_order = $node->{order}; + } else { + $node->{order} = ++$last_order; + } + } + } + my $tree = { }; $self->{by_id}{''} = $tree; @@ -167,7 +180,7 @@ sub parse_access_string { my $access = $node->{access}; - while ($access =~ m/^([a-z_\/]+|\||\&|\(|\)|\s+)/) { + while ($access =~ m/^([a-z_\/]+|\!|\||\&|\(|\)|\s+)/) { my $token = $1; substr($access, 0, length($1)) = ""; @@ -186,7 +199,7 @@ sub parse_access_string { } $cur_ary = $stack[-1]; - } elsif (($token eq "|") || ($token eq "&")) { + } elsif (($token eq "|") || ($token eq "&") || ($token eq "!")) { push @{$cur_ary}, $token; } else { @@ -260,4 +273,3 @@ sub set_access { } 1; -