Bug 20443: Move GetBorrowerAttributes to Koha::Patron->extended_attributes
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 12 Jul 2018 21:26:58 +0000 (18:26 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 23 Mar 2020 13:39:25 +0000 (13:39 +0000)
commit9707167a482894f270549ae9633eaef980f1ed35
tree35175bffd929226c7263b8d62be141acf380291a
parent85012cc0616371b1c29a4eab39829ef9d250d266
Bug 20443: Move GetBorrowerAttributes to Koha::Patron->extended_attributes

The GetBorrowerAttributes subroutine return the attributes for a given
patron.

Using get_extended_attributes we can acchieve it easily. The problematic
here is to restore the method's name (value vs attribute,
value_description vs description of the authorised value, as well as
display_checkout that should not be a method of Attribute, but
Attribute::Type instead)

value_description was used when the attribute types were attached to an
authorised value category. To avoid the necessary test in template and
controller there is now a $attribute->description method that will
display either the attribute's value OR the value of the authorised
value when needed. We should certainly use this one from few other
places.

Notes:
* This patch rename Koha::Patron->attributes with Koha::Patron->get_extended_attributes.
It will be renamed with Koha::Patron->extended_attributes in ones of the next
patches when it will become a setter as well.
* GetBorrowerAttributes did not care about the library limits, we still
do not
* The opac_only flag was not used outside of test, we drop it off.
* To maintain the existing behavior we add a default order-by clause to
the search method [code, attribute]
* From C4::Letters::_parseletter we always display the staff description
of the AV, There is now a FIXME to warn about it
* FIXMEs are not regressions, existing behaviors must be kept
* TODO add a new check to bug 21010 to search for inconsistencies in
patron's attributes attached to non-existent authorised values
* One test has been updated in Modifications.t, order_by is now
by default set to ['code', 'attribute']

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
17 files changed:
C4/Letters.pm
C4/Members/Attributes.pm
Koha/Patron.pm
Koha/Patron/Attribute.pm
Koha/Patron/Attributes.pm
Koha/Patrons/Import.pm
koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt
members/memberentry.pl
members/moremember.pl
opac/opac-memberentry.pl
t/db_dependent/Auth_with_ldap.t
t/db_dependent/Koha/Patron/Modifications.t
t/db_dependent/Koha/Patrons.t
t/db_dependent/Members/Attributes.t
tools/modborrowers.pl