Bugzilla – Attachment 139211 Details for
Bug 31373
Notice template validation is missing INCLUDE_PATH
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31373: Add INCLUDE_PATH to notice validation
Bug-31373-Add-INCLUDEPATH-to-notice-validation.patch (text/plain), 2.28 KB, created by
Kyle M Hall (khall)
on 2022-08-16 19:23:07 UTC
(
hide
)
Description:
Bug 31373: Add INCLUDE_PATH to notice validation
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-08-16 19:23:07 UTC
Size:
2.28 KB
patch
obsolete
>From f99543bb5d488829eaf23bd06dac04d3279fa00f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 16 Aug 2022 17:08:40 +0100 >Subject: [PATCH] Bug 31373: Add INCLUDE_PATH to notice validation > >This is a follow-up to bug 31211. It adds the same INCLUDE_PATH >variables as C4::Templates adds during processing to prevent false >failures. > >Test plan >1) Add an INCLUDE to any valid notice, for example: > [% INCLUDE 'patron-title.inc' patron => patron %] >2) Save and continue >3) Confirm you are faced with a validation error complaining that > the include file cannot be found >4) Apply this patch >5) Confirm that the reported error has dissapeared > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > tools/letter.pl | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > >diff --git a/tools/letter.pl b/tools/letter.pl >index 35d9a12d14..420556ff75 100755 >--- a/tools/letter.pl >+++ b/tools/letter.pl >@@ -196,6 +196,17 @@ sub add_form { > ); > my $first_flag_name = 1; > my $lang; >+ >+ # Get available includes >+ my $htdocs = C4::Context->config('intrahtdocs'); >+ my ($theme, $availablethemes); >+ ($theme, $lang, $availablethemes)= C4::Templates::availablethemes( $htdocs, 'about.tt', 'intranet', $lang); >+ my @includes; >+ foreach (@$availablethemes) { >+ push @includes, "$htdocs/$_/$lang/includes"; >+ push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en'; >+ } >+ > # The letter name is contained into each mtt row. > # So we can only sent the first one to the template. > my $tt = Template->new( >@@ -203,6 +214,7 @@ sub add_form { > EVAL_PERL => 1, > ABSOLUTE => 1, > PLUGIN_BASE => 'Koha::Template::Plugin', >+ INCLUDE_PATH => \@includes, > FILTERS => {}, > ENCODING => 'UTF-8', > } >@@ -219,6 +231,7 @@ sub add_form { > > my $output; > my $template = $letter->{content}; >+ $template = qq|[% USE KohaDates %][% USE Remove_MARC_punctuation %][% PROCESS 'html_helpers.inc' %]$template|; > unless ( $tt->process( \$template, {}, \$output ) ) { > $letter->{tt_error} = $tt->error(); > } >-- >2.30.2
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 31373
:
139210
|
139211
|
139406
|
139677
|
140456
|
140457