[Koha-bugs] [Bug 34472] Template Toolkit reference guide needed

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Mar 8 21:03:34 CET 2024


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34472

--- Comment #8 from Emily Lamancusa <emily.lamancusa at montgomerycountymd.gov> ---
Some thoughts / useful information I've come across while digging into the code
to figure out what bug 15278 will entail:
(This is mostly answering the questions of "what information do we need to
provide to users?" and "where can we find this information in the code if it
isn't well documented?")

- To get a list of what TT objects are available to notices in general,
possible places to look are two subs in C4::Letters: _get_tt_params and
_parseletter_sth.
    ~ Near the beginning of _get_tt_params, a $config variable is defined that
maps 
      database table names to Template Toolkit variable names.
    ~ _parseletter_sth actually prepares (and caches?) database queries for
notices
    ~ These two subs aren't 100% in sync with each other, though (I haven't dug
quite
      deep enough to be sure if that's a bug in and of itself)

- To know which specific tables a specific notice has access to, I believe one
way to do that would be to find the GetPreparedLetter call for that notice. A
list of tables is passed as a parameter. (git grep is your friend here)

- Due, Predue, and Overdue notices might be weird - they have some custom
handling in advance_notices.pl and overdue_notices.pl. There are also a few
other notices that have weird custom things that aren't handled yet in Template
Toolkit syntax. (See
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15278#c11)

- Some Koha-specific TT things that aren't tied to a particular table that we
should include:
    ~ accessing today's date
    ~ formatting a date
    ~ I feel like I've seen some environment context / syspref configuration
things 
      getting used in notices before? 

- We should include an explanation of how a TT variable can be singular or
plural, and when and how to use each. (Is there any situation where we'd use
the plural, other than a FOREACH loop or a count?)

- We definitely need to make sure the '----' syntax for digest notices is
documented, and probably include an explanation of when to use '----' and when
to use a FOREACH.

- I believe any database field in a given table is accessible as a variable in
notices that have access to that table? If I'm correct in that, it would be
really useful for the Template Toolkit documentation to link to the schema page
for the relevant tables.

- Ideally, it would be a nice idea to include some very basic, layman-friendly
TT info as a starting point for users who may not have a programming background
or experience reading technical documentation.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list