X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FAuth_with_ldap.pm;h=fc1d63b69e9fb8089ba5c5f87b91c7914fcb1caa;hb=4d26038dd23060de979f0b1751b05c5e4cc76083;hp=5baa07f049c82929042d40b2f63762c93d805a5a;hpb=8f21144fb154b68747d004eecca53fe84a020f22;p=koha_gimpoz diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 5baa07f049..fc1d63b69e 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -161,7 +161,7 @@ sub checkpw_ldap { ($cardnumber eq $c2) or warn "update_local returned cardnumber '$c2' instead of '$cardnumber'"; } else { # C1, D1 # maybe update just the password? - return(1, $cardnumber); # FIXME dpavlin -- don't destroy ExtendedPatronAttributes + return(1, $cardnumber, $local_userid); } } elsif ($config{replicate}) { # A2, C2 $borrowernumber = AddMember(%borrower) or die "AddMember failed"; @@ -189,7 +189,7 @@ sub checkpw_ldap { } C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); } -return(1, $cardnumber); +return(1, $cardnumber, $userid); } # Pass LDAP entry object and local cardnumber (userid). @@ -228,6 +228,17 @@ sub ldap_entry_2_hash ($$) { ( substr($borrower{'firstname'},0,1) . substr($borrower{ 'surname' },0,1) . " "); + + # check if categorycode exists, if not, fallback to default from koha-conf.xml + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?"); + $sth->execute( uc($borrower{'categorycode'}) ); + unless ( my $row = $sth->fetchrow_hashref ) { + my $default = $mapping{'categorycode'}->{content}; + $debug && warn "Can't find ", $borrower{'categorycode'}, " default to: $default for ", $borrower{userid}; + $borrower{'categorycode'} = $default + } + return %borrower; } @@ -356,7 +367,8 @@ C4::Auth - Authenticates Koha users | dateexpiry | date | YES | | NULL | | | gonenoaddress | tinyint(1) | YES | | NULL | | | lost | tinyint(1) | YES | | NULL | | - | debarred | tinyint(1) | YES | | NULL | | + | debarred | date | YES | | NULL | | + | debarredcomment | varchar(255) | YES | | NULL | | | contactname | mediumtext | YES | | NULL | | | contactfirstname | text | YES | | NULL | | | contacttitle | text | YES | | NULL | |