[Koha-bugs] [Bug 17971] TT syntax for notices - Add support for plurals

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jan 23 16:05:14 CET 2017


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

--- Comment #1 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Created attachment 59426
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=59426&action=edit
Bug 17971: TT syntax for notices - Add support for plurals

On of the awesome things we will be able to do with the TT syntax is the
support of plurals.

For instance we will be able to send a list of items, checkouts, etc. to the
notice template.
That way we will get rid of our custom syntax like <<items.content>> or
<item></item> for instance.

The existing code already has the playground for that but it is not used.

Basically the idea is to add a "loops" key which can contain a list of
object to retrieve from the DB and send to the template.
For instance:
    loops => { overdues => [ $itemnumber_1, .., $itemnumber_N ] }

will send a variable "overdues" to the template. It will contain the
Koha::Checkout objects relative to the id passed.

There is one quite big inconvenient to this approach so far: since we
are still supporting the historical syntax, the objects can be fetch by
a script, then the script will send the id to GetPreparedLetter which
will refetch them.
This must be improved, but I suggest to do that later.

Test plan:
  prove t/db_dependent/Letters/TemplateToolkit.t
should return green

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


More information about the Koha-bugs mailing list