Bugzilla – Attachment 155997 Details for
Bug 34862
blocking_errors.inc not included everywhere
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34862: [DO NOT PUSH] add script
Bug-34862-DO-NOT-PUSH-add-script.patch (text/plain), 2.16 KB, created by
Jonathan Druart
on 2023-09-21 13:13:08 UTC
(
hide
)
Description:
Bug 34862: [DO NOT PUSH] add script
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-09-21 13:13:08 UTC
Size:
2.16 KB
patch
obsolete
>From 7d5c03ad7926b5505ea66cf695bc17667a56747c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 21 Sep 2023 14:40:26 +0200 >Subject: [PATCH] Bug 34862: [DO NOT PUSH] add script > >--- > 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|<main| } @lines; >+ my $spacing = q{}; >+ my ( $in_main, $line_open_main ); >+ my ( $line_number, $number_replaced_mains ) = (0, 0); >+ for my $line (@lines) { >+ $line_number++; >+ if ( $line =~ m{^(\s*)<main} ) { >+ $spacing = $1 . " "; >+ $in_main = 1; >+ $line_open_main = $line_number; >+ } elsif (!$has_main_tag && $line =~ m{(\s*)<div class="main} ) { >+ $spacing = $1 . " "; >+ $in_main = 1; >+ $line_open_main = $line_number + 2; >+ } >+ if ( $in_main ) { >+ splice @new_lines, $line_open_main + $number_replaced_mains, 0, $spacing . $messages_include; >+ $number_replaced_mains++; >+ $in_main = 0; >+ } >+ } >+ write_file($file, @new_lines); >+} >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34862
:
155991
|
155992
|
155993
|
155997
|
155998
|
155999
|
156000
|
158755
|
158756
|
158757
|
158758
|
158759
|
159472
|
159473
|
159474
|
159475
|
159476
|
159477
|
161666
|
161667
|
161668
|
161669
|
161670
|
161671
|
161672
|
161673
|
161674
|
161675
|
161676
|
161677
|
161678