Bug 8919 - ExtendedPatronAttributes not populated from LDAP
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 15 Oct 2012 12:55:05 +0000 (14:55 +0200)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 8 Nov 2012 17:42:52 +0000 (12:42 -0500)
commit24125d4be39a3b6f19b1b0ae3f51855575a01759
tree276035c8e8346e6d5bb79d0e950ef60b98fc687a
parent612fa3f1584338b4eaf4f91ab0cac9d86395cf35
Bug 8919 - ExtendedPatronAttributes not populated from LDAP

Current code is overly complex and assumes that
C4::Members::AttributeTypes::GetAttributeTypes
returns array of attribute codes which is not true.

Instead it return array of hashes so none of extended attributes
will be replicated from LDAP.

This code correctly extracts extended attributes from borrower data
provides simpler code which fills same structure.

It also skips empty values (" ") which are result of mapping without
any default value. This is needed to make unique extended patron values
work. If not handled it would insert empty value for first user and
fail for all others on uniqueness constraint.

Test scenario:

1. define Patron attribute types in administration
2. define mapping from LDAP fields to attributes in koha-conf.xml
3. login as new user with LDAP fields and verify that extended
   attributes are replicated from LDAP

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Passed-QA-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
C4/Auth_with_ldap.pm