Bugzilla – Attachment 12848 Details for
Bug 8919
ExtendedPatronAttributes not populated from LDAP
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8919 - ExtendedPatronAttributes not populated from LDAP
Bug-8919---ExtendedPatronAttributes-not-populated-.patch (text/plain), 2.21 KB, created by
Dobrica Pavlinusic
on 2012-10-16 11:41:04 UTC
(
hide
)
Description:
Bug 8919 - ExtendedPatronAttributes not populated from LDAP
Filename:
MIME Type:
Creator:
Dobrica Pavlinusic
Created:
2012-10-16 11:41:04 UTC
Size:
2.21 KB
patch
obsolete
>From 591d0359e340576a490848d707ce2534bd8c71fa Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Mon, 15 Oct 2012 14:55:05 +0200 >Subject: [PATCH] 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 >--- > C4/Auth_with_ldap.pm | 10 ++++++---- > 1 files changed, 6 insertions(+), 4 deletions(-) > >diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm >index 2f2bb27..9b1c7ca 100644 >--- a/C4/Auth_with_ldap.pm >+++ b/C4/Auth_with_ldap.pm >@@ -169,11 +169,13 @@ sub checkpw_ldap { > return 0; # B2, D2 > } > if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) { >- my @types = C4::Members::AttributeTypes::GetAttributeTypes(); >- my @attributes = grep{my $key=$_; any{$_ eq $key}@types;} keys %borrower; > my $extended_patron_attributes; >- @{$extended_patron_attributes} = >- map { { code => $_, value => $borrower{$_} } } @attributes; >+ foreach my $attribute_type ( C4::Members::AttributeTypes::GetAttributeTypes() ) { >+ my $code = $attribute_type->{code}; >+ if ( exists $borrower{$code} ) { >+ push @$extended_patron_attributes, { code => $code, value => $borrower{$code} }; >+ } >+ } > my @errors; > #Check before add > for (my $i; $i< scalar(@$extended_patron_attributes)-1;$i++) { >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8919
:
12814
|
12848
|
12868
|
13241