View | Details | Raw Unified | Return to bug 11807
Collapse All | Expand All

(-)a/C4/Auth_with_ldap.pm (-1 / +22 lines)
Lines 26-31 use C4::Context; Link Here
26
use C4::Members qw(AddMember changepassword);
26
use C4::Members qw(AddMember changepassword);
27
use C4::Members::Attributes;
27
use C4::Members::Attributes;
28
use C4::Members::AttributeTypes;
28
use C4::Members::AttributeTypes;
29
use C4::Dates;
29
use C4::Auth qw(checkpw_internal);
30
use C4::Auth qw(checkpw_internal);
30
use Koha::AuthUtils qw(hash_password);
31
use Koha::AuthUtils qw(hash_password);
31
use List::MoreUtils qw( any );
32
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 248-253 sub ldap_entry_2_hash { Link Here
248
  		. substr($borrower{ 'surname' },0,1)
258
  		. substr($borrower{ 'surname' },0,1)
249
  		. " ");
259
  		. " ");
250
260
261
    # Date and categorycode conversions
262
    $borrower{'dateexpiry'} = C4::Dates->new($borrower{'dateexpiry'},'sql')->output('iso') if $borrower{'dateexpiry'};
263
    $borrower{'dateofbirth'} = C4::Dates->new($borrower{'dateofbirth'},'sql')->output('iso') if $borrower{'dateofbirth'};
264
    $borrower{'dateenrolled'} = C4::Dates->new($borrower{'dateenrolled'},'sql')->output('iso') if $borrower{'dateenrolled'};
265
266
    if(defined $categorycode_conversions{$borrower{categorycode}}) {
267
        $borrower{categorycode} = $categorycode_conversions{$borrower{categorycode}};
268
    }
269
    elsif($default_categorycode) {
270
        $borrower{categorycode} = $default_categorycode;
271
    }
272
251
	# check if categorycode exists, if not, fallback to default from koha-conf.xml
273
	# check if categorycode exists, if not, fallback to default from koha-conf.xml
252
	my $dbh = C4::Context->dbh;
274
	my $dbh = C4::Context->dbh;
253
	my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?");
275
	my $sth = $dbh->prepare("SELECT categorycode FROM categories WHERE categorycode = ?");
254
- 

Return to bug 11807