|
Lines 27-32
use C4::Members qw(AddMember changepassword);
Link Here
|
| 27 |
use C4::Members::Attributes; |
27 |
use C4::Members::Attributes; |
| 28 |
use C4::Members::AttributeTypes; |
28 |
use C4::Members::AttributeTypes; |
| 29 |
use C4::Members::Messaging; |
29 |
use C4::Members::Messaging; |
|
|
30 |
use C4::Dates; |
| 30 |
use C4::Auth qw(checkpw_internal); |
31 |
use C4::Auth qw(checkpw_internal); |
| 31 |
use Koha::AuthUtils qw(hash_password); |
32 |
use Koha::AuthUtils qw(hash_password); |
| 32 |
use List::MoreUtils qw( any ); |
33 |
use List::MoreUtils qw( any ); |
|
Lines 66-71
$debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys ( total ): ",
Link Here
|
| 66 |
@mapkeys = grep {defined $mapping{$_}->{is}} @mapkeys; |
67 |
@mapkeys = grep {defined $mapping{$_}->{is}} @mapkeys; |
| 67 |
$debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys (populated): ", join ' ', @mapkeys, "\n"; |
68 |
$debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys (populated): ", join ' ', @mapkeys, "\n"; |
| 68 |
|
69 |
|
|
|
70 |
my %categorycode_conversions; |
| 71 |
my $default_categorycode; |
| 72 |
if(defined $ldap->{categorycode_mapping}) { |
| 73 |
$default_categorycode = $ldap->{categorycode_mapping}->{default}; |
| 74 |
foreach my $cat (@{$ldap->{categorycode_mapping}->{categorycode}}) { |
| 75 |
$categorycode_conversions{$cat->{value}} = $cat->{content}; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 69 |
my %config = ( |
79 |
my %config = ( |
| 70 |
anonymous => ($ldapname and $ldappassword) ? 0 : 1, |
80 |
anonymous => ($ldapname and $ldappassword) ? 0 : 1, |
| 71 |
replicate => defined($ldap->{replicate}) ? $ldap->{replicate} : 1, # add from LDAP to Koha database for new user |
81 |
replicate => defined($ldap->{replicate}) ? $ldap->{replicate} : 1, # add from LDAP to Koha database for new user |
|
Lines 263-268
sub ldap_entry_2_hash {
Link Here
|
| 263 |
. substr($borrower{ 'surname' },0,1) |
273 |
. substr($borrower{ 'surname' },0,1) |
| 264 |
. " "); |
274 |
. " "); |
| 265 |
|
275 |
|
|
|
276 |
# Date and categorycode conversions |
| 277 |
$borrower{'dateexpiry'} = C4::Dates->new($borrower{'dateexpiry'},'sql')->output('iso') if $borrower{'dateexpiry'}; |
| 278 |
$borrower{'dateofbirth'} = C4::Dates->new($borrower{'dateofbirth'},'sql')->output('iso') if $borrower{'dateofbirth'}; |
| 279 |
$borrower{'dateenrolled'} = C4::Dates->new($borrower{'dateenrolled'},'sql')->output('iso') if $borrower{'dateenrolled'}; |
| 280 |
|
| 281 |
if(defined $categorycode_conversions{$borrower{categorycode}}) { |
| 282 |
$borrower{categorycode} = $categorycode_conversions{$borrower{categorycode}}; |
| 283 |
} |
| 284 |
elsif($default_categorycode) { |
| 285 |
$borrower{categorycode} = $default_categorycode; |
| 286 |
} |
| 287 |
|
| 266 |
# check if categorycode exists, if not, fallback to default from koha-conf.xml |
288 |
# check if categorycode exists, if not, fallback to default from koha-conf.xml |
| 267 |
my $dbh = C4::Context->dbh; |
289 |
my $dbh = C4::Context->dbh; |
| 268 |
my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?"); |
290 |
my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?"); |
| 269 |
- |
|
|