From 14d5e841cdfbce63dad0d3e05cd8ae8339f5f9db Mon Sep 17 00:00:00 2001 From: Oliver Behnke Date: Fri, 7 Feb 2020 12:31:31 +0000 Subject: [PATCH] Bug 16719: Pass through undef rather than empty string in LDAP mapping Nullable DB fields should be passed null in cases where ldap fields are empty and not replaced with empty strings. Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson (cherry picked from commit 0dac0b874779bc7617490199944af1d2b807e656) Signed-off-by: Lucas Gass --- C4/Auth_with_ldap.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 6f3b9a3828..a00ed0b9cc 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -275,9 +275,9 @@ sub ldap_entry_2_hash { my $data = $memberhash{ lc($mapping{$key}->{is}) }; # Net::LDAP returns all names in lowercase $debug and printf STDERR "mapping %20s ==> %-20s (%s)\n", $key, $mapping{$key}->{is}, $data; unless (defined $data) { - $data = $mapping{$key}->{content} || ''; # default or failsafe '' + $data = $mapping{$key}->{content} || undef; } - $borrower{$key} = ($data ne '') ? $data : ' ' ; + $borrower{$key} = $data; } $borrower{initials} = $memberhash{initials} || ( substr($borrower{'firstname'},0,1) -- 2.39.5