View | Details | Raw Unified | Return to bug 27957
Collapse All | Expand All

(-)a/C4/Auth_with_ldap.pm (-14 / +9 lines)
Lines 233-253 sub checkpw_ldap { Link Here
233
    if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) {
233
    if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) {
234
        my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
234
        my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
235
        my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
235
        my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id);
236
        while ( my $attribute_type = $attribute_types->next ) {
236
        my $patron = Koha::Patrons->find($borrowernumber);
237
            my $code = $attribute_type->code;
237
        if ( $patron ) {
238
            unless (exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) {
238
            my @attributes;
239
                next;
239
            while ( my $attribute_type = $attribute_types->next ) {
240
            }
240
                my $code = $attribute_type->code;
241
            my $patron = Koha::Patrons->find($borrowernumber);
241
                unless (exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) {
242
            if ( $patron ) { # Should not be needed, but we are in C4::Auth LDAP...
242
                    next;
243
                eval {
244
                    my $attribute = Koha::Patron::Attribute->new({code => $code, attribute => $borrower{$code}});
245
                    $patron->extended_attributes([$attribute->unblessed]);
246
                };
247
                if ($@) { # FIXME Test if Koha::Exceptions::Patron::Attribute::NonRepeatable
248
                    warn "ERROR_extended_unique_id_failed $code $borrower{$code}";
249
                }
243
                }
244
                push @attributes, { code => $code, attribute => $borrower{$code} };
250
            }
245
            }
246
            $patron->extended_attributes(\@attributes);
251
        }
247
        }
252
    }
248
    }
253
    return(1, $cardnumber, $userid);
249
    return(1, $cardnumber, $userid);
254
- 

Return to bug 27957