X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FAuth_with_ldap.pm;h=fc1d63b69e9fb8089ba5c5f87b91c7914fcb1caa;hb=beb0678bfc9957145895a792a8bed42815f4ad22;hp=7f56d9c59802a1393ede6b9cbd69a760c8755093;hpb=a118102d4e2d7cf6bc1157a560c52fd6deb6f7a7;p=koha_gimpoz diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 7f56d9c598..fc1d63b69e 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -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 | |