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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit 0dac0b8747)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Oliver Behnke 2020-02-07 12:31:31 +00:00 committed by Lucas Gass
parent 9ee605ea9f
commit 14d5e841cd
1 changed files with 2 additions and 2 deletions

View File

@ -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)