[Koha-bugs] [Bug 30657] Make patron attributes available via Template Toolkit in overdues

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Mar 8 11:20:53 CET 2024


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

--- Comment #7 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
There are already a couple of options here I believe.. but I think we should
perhaps make it simpler/clearer.

You can use all accessors available from the Koha::Patron object assuming
you've been passed said object into the template.

We have a few different attribute accessors:

* 'extended_attributes' which returns a resultset of attached extended
attributes
* 'get_extended_attribute(code)' which returns the attribute associated with
the code passed (but doesn't work properly for repeatable attributes)

To use those in TT:

*  [% FOREACH extendedattribute IN patron.extended_attributes %]
        <li class="patronattribute">
            <span class="patronattributelabel">[%
extendedattribute.type.description | html %]</span>: [%
extendedattribute.description | html %]
        </li>
    [% END %]

* [% SET attribute = patron.get_extended_attribute('code') %]
  [% attribute.description | html %]

The second one is clearly simpler to use, but only works for non-repeatable
attributes so you need to know a little about the underlying patron data setup.
 I also think it's a get wordy 'get_' and would prefer, I think, to have a
simple 'extended_attribute($code)' accessor.

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


More information about the Koha-bugs mailing list