X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fgenerate_client_js_actions.pl;h=a51c669c7545de62cb343ffdf5f0cacd860f4766;hb=45659209a7151609c68e28281fe06407076cea5f;hp=d2219a1d1d1929cdd20516ff8bc84bd71e71e145;hpb=2473bd32292484336637336bc6968a0f329d9ad4;p=kivitendo-erp.git diff --git a/scripts/generate_client_js_actions.pl b/scripts/generate_client_js_actions.pl index d2219a1d1..a51c669c7 100755 --- a/scripts/generate_client_js_actions.pl +++ b/scripts/generate_client_js_actions.pl @@ -15,7 +15,7 @@ foreach (read_file("${rel_dir}/SL/ClientJS.pm")) { next unless (m/^my \%supported_methods/ .. m/^\);/); - push @actions, [ 'action', $1, $2, $3 ] if m/^ \s+ '? ([a-zA-Z_:]+) '? \s*=>\s* (\d+) , (?: \s* \# \s+ (.+))? $/x; + push @actions, [ 'action', $1, $2, $3 ] if m/^ \s+ '? ([a-zA-Z_:]+) '? \s*=>\s* (-? \d+) , (?: \s* \# \s+ (.+))? $/x; push @actions, [ 'comment', $1, $2 ] if m/^ \s+\# \s+ (.+?) (?: \s* pattern: \s+ (.+))? $/x; } @@ -33,7 +33,9 @@ foreach my $action (@actions) { $pattern = $action->[2] eq '' ? $default_pattern : $action->[2] if $action->[2]; } else { - my $args = $action->[2] == 1 ? '' : join(', ', map { "action[$_]" } (2..$action->[2])); + my $args = $action->[2] == 1 ? '' + : $action->[2] < 0 ? 'action.slice(2, action.length)' + : join(', ', map { "action[$_]" } (2..$action->[2])); $output .= sprintf(' %s if (action[0] == \'%s\')%s ', $first ? ' ' : 'else', @@ -47,6 +49,7 @@ foreach my $action (@actions) { $call =~ s//'action[1]'/eg; $call =~ s//$function/eg; $call =~ s//$args/eg; + $call =~ s//'action[' . ($1 + 1) . ']'/eg; $output .= $call . ";\n"; $first = 0;