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

--- Comment #55 from Martin Renvoize (ashimema) 
<[email protected]> ---
Thanks Lisette and David. I agree that a bare `borrower.CODE` is too risky:
attribute codes are free text and could shadow existing or future Koha::Patron
methods and columns.

I've reworked the patch (attachment 209026, replacing the earlier series, which
I have obsoleted). The per-code accessors and AUTOLOAD are gone. Instead there
is a single, explicitly named method, Koha::Patron->extended_attribute_values,
which returns a hashref keyed by attribute code (repeatable types as an
arrayref, always present; non-repeatable as the value or undef):

  [% borrower.extended_attribute_values.UNCLE %]

  [% FOREACH nick IN borrower.extended_attribute_values.NICKNAMES %]
    [% nick | html %]
  [% END %]

A code like "surname" stays under the hash, so it can never shadow the patron's
own accessor (there is a test for that), and there is no dynamic method
generation or extra query on missing method calls. I also checked it by
rendering a Template Toolkit snippet against a patron with both attribute
kinds.

If people would prefer a different name for the method, it is easy to change,
so please say if so.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to