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)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 5 Aug 2019 14:50:39 +0000 (15:50 +0100)
commit8c517d2f2860c08263f44dfde8d3cadea418694e
tree5fcac9860daf2fc21fc42fc8da286a1a136da57a
parent43b0ef8f535bb1bd8341997d25675741b2ad0776
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>
Koha/Plugins/Base.pm