Summary: | Add Template::Plugin::JSON to handle JSON in Template Toolkit | ||
---|---|---|---|
Product: | Koha | Reporter: | Andrew Fuerste-Henry <andrew> |
Component: | Packaging | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | Needs documenting --- | QA Contact: | David Cook <dcook> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | dcook, fridolin.somers, jonathan.druart, lucas, mtj, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39184 | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: |
This patch adds a new Template::Toolkit library to Koha's dependencies. This library, while not directly used in Koha, can be used in Template::Toolkit-driven templates to access JSON structures (e.g. notices, report templates, etc).
A good example is making report templates that include JSON columns, like `background_jobs.data`.
|
|
Version(s) released in: |
25.11.00,25.05.02
|
Circulation function: | |
Attachments: |
Bug 40164: Add Template::Plugin::JSON dependency
Bug 40164: Add Template::Plugin::JSON dependency Bug 40164: (follow-up) Update debian/control |
Description
Andrew Fuerste-Henry
2025-06-18 14:38:54 UTC
Created attachment 183334 [details] [review] Bug 40164: Add Template::Plugin::JSON dependency Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> I've taken a look at Template::Plugin::JSON, JSON, and JSON::XS and I think overall this should be OK. There are some security considerations mentioned in JSON::XS, but I don't think it's anything that isn't already a potential problem. I thought about creating a Template::Plugin::XML at one point, but it had too many security issues, so I ended up raising bug 39296 to add a Template plugin that lets you take MARCXML and manipulate it with MARC::Record. You might find that one interesting too. I added bug 39184 as a dependency but technically it's not. Created attachment 183362 [details] [review] Bug 40164: Add Template::Plugin::JSON dependency Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Cook <dcook@prosentient.com.au> I think we should have a test for this. (In reply to Jonathan Druart from comment #5) > I think we should have a test for this. Not a bad idea. What do you have in mind? (In reply to Jonathan Druart from comment #5) > I think we should have a test for this. Do we actually have any test for notices using *any* TT plugin? (In reply to Tomás Cohen Arazi (tcohen) from comment #7) > (In reply to Jonathan Druart from comment #5) > > I think we should have a test for this. > > Do we actually have any test for notices using *any* TT plugin? Touché! I don't know specifically about tests for notices using TT plugins, but we do have some unit tests for home-made TT plugins like t/Koha/Plugins/SafeURL.t, It's not clear to me what we'd be trying to test when bringing in a third-party plugin though. I suppose we could test that the plugin does what we're hoping/wanting/expecting it to do, so that if there is an upstream change we catch it early. But I don't know. (In reply to Tomás Cohen Arazi (tcohen) from comment #7) > (In reply to Jonathan Druart from comment #5) > > I think we should have a test for this. > > Do we actually have any test for notices using *any* TT plugin? I agree it would be useful to have a test, using this TT plugin. And document how to use it for end users. The test should help us detect breaking changes in the plugin. I agree with adding them. Maybe in a separate bug. Will try tomorrow at the office Nice work everyone! Pushed to main for 25.11 Jenkins is failing because of this. No need to use selenium to recreate the problem. https://snipboard.io/50SkDI.jpg Reverted from main, please fix if you'd like it back in. The dependency is already packaged for the stable branches and the 'koha-staging' repo as well. I think we just didn't patch contron.in. That's usually done in a different report. I patched KTD so it includes our community-packaged version of the required library. Will talk to Mason about getting it pulled without this manual step in KTD. I think it can be de-reverted Created attachment 183773 [details] [review] Bug 40164: (follow-up) Update debian/control Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (In reply to Lucas Gass (lukeg) from comment #12) > Reverted from main, please fix if you'd like it back in. Done. Nice work everyone! Pushed to main for 25.11 Nice work everyone! Pushed to 25.05.x Enhancement not pushed to 24.11.x |