X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FMenu.pm;h=b91611242ff4c889791dcacaa72a8ab8bed47c67;hb=117332fcc34457aadb85db18dbc42f48d32b732e;hp=bdac42c0de54a5a11904540a48767bcf0802f68e;hpb=b686560537b3e522fdfd0f8a81fa1d9b7c7114d8;p=kivitendo-erp.git diff --git a/SL/Menu.pm b/SL/Menu.pm index bdac42c0d..b91611242 100644 --- a/SL/Menu.pm +++ b/SL/Menu.pm @@ -43,8 +43,8 @@ sub new { die 'not an array ref' unless $data && 'ARRAY' eq ref $data; # TODO get better diag to user # in particular duplicate ids tend to come up as a user error when editing the menu files - my %uniq_ids; - $uniq_ids{$_->{id}}++ && die "Error in $file: duplicate id $_->{id}" for @$data; + #my %uniq_ids; + #$uniq_ids{$_->{id}}++ && die "Error in $file: duplicate id $_->{id}" for @$data; _merge($nodes, $nodes_by_id, $data); } @@ -212,14 +212,16 @@ sub href_for_node { return undef if !$node->{href} && !$node->{module} && !$node->{params}; - my $href = $node->{href} || $node->{module} || 'controller.pl'; - my @tokens; + return $node->{href_for_node} ||= do { + my $href = $node->{href} || $node->{module} || 'controller.pl'; + my @tokens; - while (my ($key, $value) = each %{ $node->{params} }) { - push @tokens, uri_encode($key, 1) . "=" . uri_encode($value, 1); - } + while (my ($key, $value) = each %{ $node->{params} }) { + push @tokens, uri_encode($key, 1) . "=" . uri_encode($value, 1); + } - return join '?', $href, grep $_, join '&', @tokens; + join '?', $href, grep $_, join '&', @tokens; + } } sub name_for_node {