X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fgenerate_client_js_actions.pl;h=a51c669c7545de62cb343ffdf5f0cacd860f4766;hb=061f4d6d32ed95055114582ede45e8387b302a53;hp=448a42c51663e776c1418cdbe1f7ba309bc8a878;hpb=9103c8184c1e8258ff4855c9755ff9b37486393b;p=kivitendo-erp.git diff --git a/scripts/generate_client_js_actions.pl b/scripts/generate_client_js_actions.pl index 448a42c51..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',