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)
committerroot <root@f1ebe1bec408>
Thu, 18 Apr 2019 09:55:34 +0000 (09:55 +0000)
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>

C4/Auth_with_ldap.pm

index 6def54d..589dbcc 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;