Bug 36654 - Add template toolkit function to get arbitrary Koha::Objects
Summary: Add template toolkit function to get arbitrary Koha::Objects
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Kyle M Hall (khall)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-19 18:25 UTC by Kyle M Hall (khall)
Modified: 2024-09-20 12:49 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 36654: Add template toolkit function to get arbitrary Koha::Objects (3.23 KB, patch)
2024-04-19 18:30 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 36654: Add template toolkit function to get arbitrary Koha::Objects (3.31 KB, patch)
2024-05-07 14:18 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 36654: Add template toolkit function to get arbitrary Koha::Objects (3.31 KB, patch)
2024-05-07 14:19 UTC, Matt Blenkinsop
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2024-04-19 18:25:44 UTC
A lot of older notice data includes ids but not the objects themselves. We should have a helper TT plugin to make getting those objects easy.
Comment 1 Kyle M Hall (khall) 2024-04-19 18:28:27 UTC
In particular, the data for overdues is difficult to access.
Comment 2 Kyle M Hall (khall) 2024-04-19 18:30:21 UTC
Created attachment 165227 [details] [review]
Bug 36654: Add template toolkit function to get arbitrary Koha::Objects

A lot of older notice data include identifiers but not the objects themselves.
We should have a helper TT plugin to make getting those objects easy.

Test Plan:
1) prove t/db_dependent/Koha/Template/Plugin/Koha.t
2) Set the CHECKOUT notice to:

[% USE Koha %]
[% SET b = Koha.GetObjectById('Koha::Biblios', b.biblionumber );
[% b.title %]

3) Note the notice contains the checkout title
Comment 3 Matt Blenkinsop 2024-05-07 14:18:19 UTC
Created attachment 166293 [details] [review]
Bug 36654: Add template toolkit function to get arbitrary Koha::Objects

A lot of older notice data include identifiers but not the objects themselves.
We should have a helper TT plugin to make getting those objects easy.

Test Plan:
1) prove t/db_dependent/Koha/Template/Plugin/Koha.t
2) Set the CHECKOUT notice to:

[% USE Koha %]
[% SET b = Koha.GetObjectById('Koha::Biblios', bblio.biblionumber ); %]
[% b.title %]

3) Note the notice contains the checkout title

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 4 Matt Blenkinsop 2024-05-07 14:19:43 UTC
Created attachment 166294 [details] [review]
Bug 36654: Add template toolkit function to get arbitrary Koha::Objects

A lot of older notice data include identifiers but not the objects themselves.
We should have a helper TT plugin to make getting those objects easy.

Test Plan:
1) prove t/db_dependent/Koha/Template/Plugin/Koha.t
2) Set the CHECKOUT notice to:

[% USE Koha %]
[% SET b = Koha.GetObjectById('Koha::Biblios', biblio.biblionumber ); %]
[% b.title %]

3) Note the notice contains the checkout title

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 5 Julian Maurice 2024-09-20 12:49:32 UTC
I think this has security implications as anyone with "edit_notices" permission could fetch any object from the database.

In the CHECKOUT notice the biblio object is available so the example given could  be rewritten simply as:

[% biblio.title %]

Can you provide another example where GetObjectById would be required ?