Bug 22461: Filter ldap mapping before inserting patron's info

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2019-03-21 14:05:49 -03:00 committed by root
parent d482c7b272
commit 4e40784f99
1 changed files with 8 additions and 1 deletions

View File

@ -221,7 +221,14 @@ sub checkpw_ldap {
return(1, $cardnumber, $local_userid);
}
} elsif ($config{replicate}) { # A2, C2
my $patron = Koha::Patron->new( \%borrower )->store;
my @columns = Koha::Patrons->columns;
my $patron = Koha::Patron->new(
map {
grep join( ' ', @columns ) =~ /$_/
? ( $_ => $data{$_} )
: ()
} keys %borrower
)->store;
die "Insert of new patron failed" unless $patron;
$borrowernumber = $patron->borrowernumber;
C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $borrowernumber, categorycode => $borrower{'categorycode'} } );