Bug 14625 - LDAP: skip extended patron attributes in 'borrowers' attribute update
authorOliver Bock <oliver.bock@aei.mpg.de>
Mon, 30 Nov 2015 12:57:58 +0000 (13:57 +0100)
committerJulian Maurice <julian.maurice@biblibre.com>
Mon, 22 May 2017 12:42:16 +0000 (14:42 +0200)
* Any extended patron attributes will cause the update to fail as those attributes don't exist in the 'borrowers' table
* The update of the extended patron attributes is already dealt with in checkpw_ldap()
* Ergo: just skip those attributes here

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
I did not test this patch but code looks good

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 4c631a0824a38177279475f77e9246087fa97515)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit f5fbf222f4c947346f7c56938ff87388ea5fb136)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

C4/Auth_with_ldap.pm

index 90c35b0..b715863 100644 (file)
@@ -333,7 +333,16 @@ sub update_local {
     my $borrowerid = shift or croak "No borrowerid";
     my $borrower   = shift or croak "No borrower record";
 
+    # skip extended patron attributes in 'borrowers' attribute update
     my @keys = keys %$borrower;
+    if (C4::Context->preference('ExtendedPatronAttributes')) {
+        foreach my $attribute_type ( C4::Members::AttributeTypes::GetAttributeTypes() ) {
+           my $code = $attribute_type->{code};
+           @keys = grep { $_ ne $code } @keys;
+           $debug and printf STDERR "ignoring extended patron attribute '%s' in update_local()\n", $code;
+        }
+    }
+
     my $dbh = C4::Context->dbh;
     my $query = "UPDATE  borrowers\nSET     " .
         join(',', map {"$_=?"} @keys) .