From eefe09826cd0b15fe3f56f289ed9e9c0d5558761 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! --- C4/Templates.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C4/Templates.pm b/C4/Templates.pm index dd54a6e3f41..594f39cf72c 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