From: Jonathan Druart Date: Thu, 21 Mar 2019 17:05:49 +0000 (-0300) Subject: Bug 22461: Filter ldap mapping before inserting patron's info X-Git-Url: http://git.equinoxoli.org/?p=koha-equinox.git;a=commitdiff_plain;h=4e40784f99f883a4f2634ed938764221d818096c Bug 22461: Filter ldap mapping before inserting patron's info Signed-off-by: Martin Renvoize Signed-off-by: Alex Arnaud Signed-off-by: Nick Clemens --- diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 3e2ab5c..6def54d 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -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'} } );