https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40285
--- Comment #3 from Jonathan Druart <[email protected]> --- (In reply to Owen Leonard from comment #2) > (In reply to Jonathan Druart from comment #1) > > But we really should not need a TT plugin for that > > Is there something about patron attributes that is different from item > types, collection codes, etc. that make the template plugin unnecessary? Or > would you also consider those to be unnecessary? It depends :D Sometimes it's just bad coding, and we are lazy and need a plugin to display the description. Sometimes it is for performance purpose (with REST API calls in mind): eg. on the holdings table of a bib record, you don't want to embed the the item type object for each items. But we should not have a TT plugin anyway IMO. We should prefer to have a mapping { code => description } and retrieve the description using item.item_type. In the case of moremember we already have the attribute type object and we can so access its description: attribute.type.description. IF the problem is performance (say you are going to display thousands of attributes), then you won't want to access/fetch the attribute type for each attribute: you will eventually want to use the same mapping mechanism as above. From the controller: $attr_types_description_mapping = { map { $_->code => $_->description } Koha::Attribute::Types->search->as_list }; Pass it to the template, then loop on the attributes in the template and display the description of the type: [% FOR attribute IN patron_attributes %] [% attr_types_description_mapping.item(attribute.code) %] [% END %] Hope that makes sense. Let me know if you have additional questions! POD for the item method: https://template-toolkit.org/docs/manual/VMethods.html#section_item -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
