|
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 65-70
$debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys ( total ): ",
Link Here
|
| 65 |
@mapkeys = grep {defined $mapping{$_}->{is}} @mapkeys; |
66 |
@mapkeys = grep {defined $mapping{$_}->{is}} @mapkeys; |
| 66 |
$debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys (populated): ", join ' ', @mapkeys, "\n"; |
67 |
$debug and print STDERR "Got ", scalar(@mapkeys), " ldap mapkeys (populated): ", join ' ', @mapkeys, "\n"; |
| 67 |
|
68 |
|
|
|
69 |
my %categorycode_conversions; |
| 70 |
my $default_categorycode; |
| 71 |
if(defined $ldap->{categorycode_mapping}) { |
| 72 |
$default_categorycode = $ldap->{categorycode_mapping}->{default}; |
| 73 |
foreach my $cat (@{$ldap->{categorycode_mapping}->{categorycode}}) { |
| 74 |
$categorycode_conversions{$cat->{value}} = $cat->{content}; |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 68 |
my %config = ( |
78 |
my %config = ( |
| 69 |
anonymous => ($ldapname and $ldappassword) ? 0 : 1, |
79 |
anonymous => ($ldapname and $ldappassword) ? 0 : 1, |
| 70 |
replicate => defined($ldap->{replicate}) ? $ldap->{replicate} : 1, # add from LDAP to Koha database for new user |
80 |
replicate => defined($ldap->{replicate}) ? $ldap->{replicate} : 1, # add from LDAP to Koha database for new user |
|
Lines 256-261
sub ldap_entry_2_hash {
Link Here
|
| 256 |
. substr($borrower{ 'surname' },0,1) |
266 |
. substr($borrower{ 'surname' },0,1) |
| 257 |
. " "); |
267 |
. " "); |
| 258 |
|
268 |
|
|
|
269 |
# Date and categorycode conversions |
| 270 |
$borrower{'dateexpiry'} = C4::Dates->new($borrower{'dateexpiry'},'sql')->output('iso') if $borrower{'dateexpiry'}; |
| 271 |
$borrower{'dateofbirth'} = C4::Dates->new($borrower{'dateofbirth'},'sql')->output('iso') if $borrower{'dateofbirth'}; |
| 272 |
$borrower{'dateenrolled'} = C4::Dates->new($borrower{'dateenrolled'},'sql')->output('iso') if $borrower{'dateenrolled'}; |
| 273 |
|
| 274 |
if(defined $categorycode_conversions{$borrower{categorycode}}) { |
| 275 |
$borrower{categorycode} = $categorycode_conversions{$borrower{categorycode}}; |
| 276 |
} |
| 277 |
elsif($default_categorycode) { |
| 278 |
$borrower{categorycode} = $default_categorycode; |
| 279 |
} |
| 280 |
|
| 259 |
# check if categorycode exists, if not, fallback to default from koha-conf.xml |
281 |
# check if categorycode exists, if not, fallback to default from koha-conf.xml |
| 260 |
my $dbh = C4::Context->dbh; |
282 |
my $dbh = C4::Context->dbh; |
| 261 |
my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?"); |
283 |
my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?"); |
| 262 |
- |
|
|