Bugzilla – Attachment 118384 Details for
Bug 27957
Attributes removed in LDAP
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27957: Fix LDAP and patron's attributes
Bug-27957-Fix-LDAP-and-patrons-attributes.patch (text/plain), 2.47 KB, created by
Jonathan Druart
on 2021-03-17 13:52:23 UTC
(
hide
)
Description:
Bug 27957: Fix LDAP and patron's attributes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-03-17 13:52:23 UTC
Size:
2.47 KB
patch
obsolete
>From 6a48377d3a22651a593b3926f654c3c788659d45 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 17 Mar 2021 12:10:21 +0100 >Subject: [PATCH] Bug 27957: Fix LDAP and patron's attributes > >--- > C4/Auth_with_ldap.pm | 26 +++++++++++++++----------- > 1 file changed, 15 insertions(+), 11 deletions(-) > >diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm >index 36b9071426..586038cb41 100644 >--- a/C4/Auth_with_ldap.pm >+++ b/C4/Auth_with_ldap.pm >@@ -233,19 +233,23 @@ sub checkpw_ldap { > if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) { > my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; > my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); >- while ( my $attribute_type = $attribute_types->next ) { >- my $code = $attribute_type->code; >- unless (exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) { >- next; >- } >- my $patron = Koha::Patrons->find($borrowernumber); >- if ( $patron ) { # Should not be needed, but we are in C4::Auth LDAP... >+ my $patron = Koha::Patrons->find($borrowernumber); >+ if ( $patron ) { >+ my @attributes; >+ while ( my $attribute_type = $attribute_types->next ) { >+ >+ my $code = $attribute_type->code; >+ unless (exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) { >+ next; >+ } >+ >+ # "repeatable" not supported > eval { >- my $attribute = Koha::Patron::Attribute->new({code => $code, attribute => $borrower{$code}}); >- $patron->extended_attributes([$attribute->unblessed]); >+ $patron->extended_attributes->search({ 'me.code' => $code })->filter_by_branch_limitations->delete; >+ $patron->add_extended_attribute({ code => $code, attribute => $borrower{$code} }); > }; >- if ($@) { # FIXME Test if Koha::Exceptions::Patron::Attribute::NonRepeatable >- warn "ERROR_extended_unique_id_failed $code $borrower{$code}"; >+ if ($@){ >+ warn sprintf "ERROR update extended attribute %s %s for patron %s (%s)", $code, $borrower{$code}, $patron->borrowernumber, $@; > } > } > } >-- >2.20.1
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 27957
:
118364
|
118365
| 118384