Bug 23237: Plugin allow [% INCLUDE %] from template
authorFrédéric Demians <f.demians@tamil.fr>
Sat, 29 Jun 2019 06:55:34 +0000 (08:55 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 9 Aug 2019 14:51:35 +0000 (16:51 +0200)
commit57e9d113b65e1f0ff1717ce288a771cfe618326e
treefe24181992a82339af09fb7a7ca9be6d7510aff4
parente59c9133e66ccf6a2537787703684bc122c31faa
Bug 23237: Plugin allow [% INCLUDE %] from template

From a plugin template it is useful to be able to include other templates with
[% INCLUDE %] directives. But TT module is used by Koha with absolute paths.
Relative paths are forbidden for security reasons. A new param [% PLUGIN_DIR %]
allow plugin templates to know where to find plugin home directory.

How to test:

1. Install kitchen-sink plugin.

2. Find tool-step1.tt file, and add this at the begining of the file:
   [% INCLUDE "$PLUGIN_DIR/header.tt" %]
   It ask to include a template header.tt which doesn't exit.

3. Run kitchen-sink plugin tool. You must have this error message:

   Template process failed: file error - _path to plugin
   directory_/Koha/Plugin/Com/ByWaterSolutions/KitchenSink/header.tt: not found

   quod erat demonstrandum

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 8c517d2f2860c08263f44dfde8d3cadea418694e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Plugins/Base.pm