Bug 22461: Clarify and correct the hash reduction
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 10 Apr 2019 13:39:40 +0000 (14:39 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 26 Apr 2019 13:40:11 +0000 (14:40 +0100)
There were a couple of bugs in the previous patch which meant it wasn't
working as intended. This patch corrects those bugs and simplifies the
code a little along the way.

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>
(cherry picked from commit c9fa30a55b585b3351ece9c3f789fd18d9807fac)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

C4/Auth_with_ldap.pm

index f0e18dd..be08a8d 100644 (file)
@@ -223,11 +223,9 @@ sub checkpw_ldap {
     } elsif ($config{replicate}) { # A2, C2
         my @columns = Koha::Patrons->columns;
         my $patron = Koha::Patron->new(
-            map {
-                grep join( ' ', @columns ) =~ /$_/
-                  ? ( $_ => $data{$_} )
-                  : ()
-            } keys %borrower
+            {
+                map { defined( $borrower{$_} ) ? ( $_ => $borrower{$_} ) : () } @columns
+            }
         )->store;
         die "Insert of new patron failed" unless $patron;
         $borrowernumber = $patron->borrowernumber;