Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / scripts / generate_client_js_actions.pl
index a51c669..f7f9a16 100755 (executable)
@@ -4,10 +4,11 @@ use strict;
 use warnings;
 
 use File::Slurp;
+use FindBin;
 use List::Util qw(first max);
 use Template;
 
-my $rel_dir = (first { -f "${_}/SL/ClientJS.pm" } qw(. ..)) || die "ClientJS.pm not found";
+my $rel_dir = $FindBin::Bin . '/..';
 my @actions;
 
 foreach (read_file("${rel_dir}/SL/ClientJS.pm")) {
@@ -58,6 +59,6 @@ foreach my $action (@actions) {
 
 $output .= sprintf "\n      else\%sconsole.log('Unknown action: ' + action[0]);\n", ' ' x (4 + 2 + 6 + 3 + 4 + 2 + $longest + 1);
 
-my $template = Template->new({ RELATIVE => 1 });
+my $template = Template->new({ ABSOLUTE => 1 });
 $template->process($rel_dir . '/scripts/generate_client_js_actions.tpl', { actions => $output }, $rel_dir . '/js/client_js.js') || die $template->error(), "\n";
 print "js/client_js.js generated automatically.\n";