Lines 165-193
sub checkpw_ldap {
Link Here
|
165 |
} else { |
165 |
} else { |
166 |
return 0; # B2, D2 |
166 |
return 0; # B2, D2 |
167 |
} |
167 |
} |
168 |
if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) { |
168 |
if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) { |
169 |
my $extended_patron_attributes; |
169 |
my @extended_patron_attributes; |
170 |
foreach my $attribute_type ( C4::Members::AttributeTypes::GetAttributeTypes() ) { |
170 |
foreach my $attribute_type ( C4::Members::AttributeTypes::GetAttributeTypes() ) { |
171 |
my $code = $attribute_type->{code}; |
171 |
my $code = $attribute_type->{code}; |
172 |
if ( exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) { # skip empty values |
172 |
if ( exists($borrower{$code}) && $borrower{$code} !~ m/^\s*$/ ) { # skip empty values |
173 |
push @$extended_patron_attributes, { code => $code, value => $borrower{$code} }; |
173 |
push @extended_patron_attributes, { code => $code, value => $borrower{$code} }; |
174 |
} |
174 |
} |
175 |
} |
175 |
} |
176 |
my @errors; |
176 |
#Check before add |
177 |
#Check before add |
177 |
my @unique_attr; |
178 |
for (my $i; $i< scalar(@$extended_patron_attributes)-1;$i++) { |
178 |
foreach my $attr ( @extended_patron_attributes ) { |
179 |
my $attr=$extended_patron_attributes->[$i]; |
179 |
if (C4::Members::Attributes::CheckUniqueness($attr->{code}, $attr->{value}, $borrowernumber)) { |
180 |
unless (C4::Members::Attributes::CheckUniqueness($attr->{code}, $attr->{value}, $borrowernumber)) { |
180 |
push @unique_attr, $attr; |
181 |
unshift @errors, $i; |
181 |
} else { |
182 |
warn "ERROR_extended_unique_id_failed $attr->{code} $attr->{value}"; |
182 |
warn "ERROR_extended_unique_id_failed $attr->{code} $attr->{value}"; |
183 |
} |
183 |
} |
184 |
} |
184 |
} |
185 |
#Removing erroneous attributes |
185 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, \@unique_attr); |
186 |
foreach my $index (@errors){ |
186 |
} |
187 |
@$extended_patron_attributes=splice(@$extended_patron_attributes,$index,1); |
|
|
188 |
} |
189 |
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); |
190 |
} |
191 |
return(1, $cardnumber, $userid); |
187 |
return(1, $cardnumber, $userid); |
192 |
} |
188 |
} |
193 |
|
189 |
|
194 |
- |
|
|