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. $Template::Stash::PRIVATE = undef; # now you can thing._private The alternate would be to rename _result and _resultset or just provide non-prefixed aliases as result and resultset respectively.
If you really need to, you can add [% PERL %]$Template::Stash::PRIVATE = undef;[% END %] to the top of your notice to all access to those methods.
Created attachment 150302 [details] [review] 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!
Created attachment 150310 [details] [review] 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 <lucas@bywatersolutions.com>
Not sure if we should go this way and put such constructs in our templates too. This needs a broader dev discussion. Please trigger it by mailing dev list or putting it on dev meeting agenda.