From 8fb0cdc6e4c27ef69c33c2f7d129b26d375fff43 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 21 Sep 2023 14:40:26 +0200 Subject: [PATCH] Bug 34862: [DO NOT PUSH] add script Signed-off-by: Kyle M Hall --- add_blocking_errors.pl | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 add_blocking_errors.pl diff --git a/add_blocking_errors.pl b/add_blocking_errors.pl new file mode 100644 index 00000000000..048bef3d4bf --- /dev/null +++ b/add_blocking_errors.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl + +use Modern::Perl; +use File::Find; +use File::Slurp; +use Data::Dumper; + +my @themes; + +# STAFF themes +my $staff_dir = 'koha-tmpl/intranet-tmpl'; +opendir ( my $dh, $staff_dir ) or die "can't opendir $staff_dir: $!"; +for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { + push @themes, "$staff_dir/$theme/en"; +} +close $dh; + +my @files; +sub wanted { + my $name = $File::Find::name; + push @files, $name + if $name =~ m[\.(tt)$] and -f $name; +} + +find({ wanted => \&wanted, no_chdir => 1 }, @themes ); + +my @errors; +for my $file ( @files ) { + add_messages($file); +} + +sub add_messages { + my ( $file ) = @_; + + my $messages_include = "[% INCLUDE 'messages.inc' %]\n"; + my @lines = read_file($file); + my @new_lines = @lines; + my $has_main_tag = grep { $_ =~ m|