From b5268fd65695cc5c408f3989a02abc180dc6848e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 21 Mar 2019 14:05:49 -0300 Subject: [PATCH] Bug 22461: Filter ldap mapping before inserting patron's info --- C4/Auth_with_ldap.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 3e2ab5cb86..6def54d415 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'} } ); -- 2.11.0