From ebdc3e8b5ab615012884ccd2ab47e717056a49b4 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 27 Apr 2023 10:28:50 -0400 Subject: [PATCH] Bug 32453: Allow template access to _result/_resultset There are times where it would be really useful to be able to access the underying result or resultset within out templates. However, Template Toolkit itself disallows this, but you can disable this feature by setting the $Template::Stash::PRIVATE package variable to a false value. Test Plan: 1) Modify the CHECKOUT notice, add "*[% biblio._result %]*" to your notice 2) Generate a CHECKOUT notice, note you only get "**" 3) Apply this patch 4) Restart all the things! 5) Generate a CHECKOUT notice, note you know get something like "*Koha::Schema::Result::Biblio=HASH(0x564f907a3390*" in your notice! Signed-off-by: Lucas Gass --- C4/Templates.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C4/Templates.pm b/C4/Templates.pm index dd54a6e3f4..594f39cf72 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -74,6 +74,9 @@ sub new { ENCODING => 'UTF-8', } ) or die Template->error(); + + $Template::Stash::PRIVATE = undef; ## Enable access to private methods like _result/_resultset + my $self = { TEMPLATE => $template, VARS => {}, -- 2.30.2