From ec435766997e2b19bcab1641f1c4cbe447806286 Mon Sep 17 00:00:00 2001 From: Lee Jamison Date: Thu, 1 Sep 2016 09:19:27 -0400 Subject: [PATCH] Bug 17215 - Cardnumbers of patrons created using LDAP Replication not using autoMemberNum if configured To test: 1. Set the autoMemberNum System Preference to "Don't". 2. Login to the OPAC with an LDAP account that does not currently exist as a patron record. 3. Check the patron record's cardnumber. 4. the cardnumber should equal the patron's LDAP username. 5. Delete the patron record. 6. Apply the patch. 7. Set the autoMemberNum System Preference to "Do". 8. Login to the OPAC with an LDAP account that does not currently exist as a patron record. 9. Check the patron record's cardnumber. 10. The cardnumber should now be the next highest cardnumber based on autoMemberNum. Signed-off-by: Lee Jamison --- C4/Auth_with_ldap.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 03e81e1..157dfe0 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -23,7 +23,7 @@ use Carp; use C4::Debug; use C4::Context; -use C4::Members qw(AddMember); +use C4::Members qw(AddMember fixup_cardnumber); use C4::Members::Attributes; use C4::Members::AttributeTypes; use C4::Members::Messaging; @@ -238,7 +238,14 @@ sub checkpw_ldap { # sub ldap_entry_2_hash { my $userldapentry = shift; - my %borrower = ( cardnumber => shift ); + my $autonumber_members = C4::Context->boolean_preference('autoMemberNum') || 0; + my %borrower; + if($autonumber_members) { + $borrower{'cardnumber'} = fixup_cardnumber($borrower{'cardnumber'}); + } + else { + $borrower{'cardnumber'} = shift; + } my %memberhash; $userldapentry->exists('uid'); # This is bad, but required! By side-effect, this initializes the attrs hash. if ($debug) { -- 2.1.4