IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Modules Perl Discussion :

Net::FLDAP introuvable


Sujet :

Modules Perl

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 27
    Par défaut Net::FLDAP introuvable
    Bonjour,
    J'ai récupéré un script qui utilise
    Net::FLDAP

    Je ne trouve pas ce module sur CPAN.
    Le connaissez-vous? Ou puis -je le récupérer?
    Cordialement

  2. #2
    Membre chevronné
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    427
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 427
    Par défaut
    tu es certain que ca n'est pas Net::LDAP ?
    essai peut etre de virer le F pour voir ce qui se passe?

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 27
    Par défaut
    sur, car dans le même fichier, il y a aussi :
    use LDAP

  4. #4
    Responsable Perl et Outils

    Avatar de djibril
    Homme Profil pro
    Inscrit en
    Avril 2004
    Messages
    19 822
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 19 822
    Par défaut
    j'ai regarde sur CPAN, mais en effet, il n'existe pas.
    Alors soit il a été retiré du CPAN, ce qui m'etonnerait. Je pense que c'est le proprietaire du script qui avait dû creer ce module. Mais si tu n'a que le script, t'es pas sorti de l'auberge.
    Peux tu nous montrer ce script!!

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 27
    Par défaut
    OK

    Part 1
    ------
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
     
    #!/usr/bin/perl
     
    ###############################################################################
    #
    # Programme :\tverification_Email_Annuaire_ADC.pl
    #
    ###############################################################################
    # 
    # Description :\tcomparaison donnees nom, prenom, telephone, mel entre MX1/adc/LDAP
    #	, exportation ANAIS(Annuaire-organigramme) et aliases de recherche
    #
    # usage :\t./verification_Email_Annuaire_ADC.pl
    # 
    # $Id: ConstruireExportLDIF_Avec_NUMIND-NUMEN_Infocentre.pl,v 1.1 2006/09/08 05:25:49 eferey Exp eferey $
    #
    # $Log
    #
    #
    ################################################################################
     
    # Packages 
    use Getopt::Std;
    use Net::LDAP qw(LDAP_REFERRAL LDAP_ADMIN_LIMIT_EXCEEDED LDAP_SIZELIMIT_EXCEEDED);
    use Net::FLDAP;
    use IO::Socket;
    use IO::Select;
    use Unicode::String qw(latin1 utf8);
    use Net::LDAP::Util qw(ldap_error_text ldap_error_name);
    use MIME::Base64 qw(encode_base64);
    use Email::Valid;
    use Digest::SHA1;
    #use utf8;
    use strict;
     
    sub verif_email {
    	my $email = $_[0];
    	if ($email =~ /^(\w|\-|\_|\.)+\@((\w|\-|\_)+\.)+[a-zA-Z]{2,}$/)
    	{
    		return -1;
    	}
    	else {
    		return 0;
    	}
    }
    sub format_tel {
    	my $tel = $_[0];
    	$tel =~ s/(^ +)|( +$)//g;
    	$tel =~ s/(^\.+)|(\.+$)//g;
    	$tel =~ s/O/0/g;
            $tel =~ s/\-/ /g;
            $tel =~ s/ +/ /g;
            $tel =~ s/ /\./g;
            $tel =~ s/\. /\./g;
            $tel =~ s/\.\.+/\./g;
            $tel =~ s/;/\./g;
            $tel =~ s/,/\./g;
            $tel =~ s/\./-/g;
            $tel =~ s/([0-9][0-9])([0-9][0-9])/\1-\2/g;
            $tel =~ s/([0-9][0-9])([0-9][0-9])/\1-\2/g;
    	return $tel;
    }
    sub SeedHASH {
    #use Digest::SHA1;
    #use MIME::Base64;
    my $tel = $_[0];
    my $ctx;
    my $hashedPasswd;
    $ctx = Digest::SHA1->new;
    $ctx->add($tel);
    $ctx->add('salt');
    $hashedPasswd = '{SSHA}' . encode_base64($ctx->digest . 'salt' ,'');
    return $hashedPasswd;
    #print 'userPassword: ' .  $hashedPasswd . "\n";
    }
    sub exportligneaccent
    {
            my($FD, $Ligne) = @_;
            $_=$Ligne;
            if (/[ÀÁÂÃÄÅaáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèeêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ]/) {
    		my @tab=split(/: /,$Ligne);
    		my $temp = latin1($tab[1])->utf8;
    		$temp = encode_base64($temp, "");
    		die "Err04 fichier :\tImpossible d'ecrire dans le fichier de sortie\n" unless print $FD "$tab[0]:: $temp\n";
    	}
    	else
    		{die "Err04 fichier :\tImpossible d'ecrire dans le fichier de sortie\n" unless print $FD "$Ligne\n";}
    }
     
    my $chSuffixesMels = " cne-evaluation.fr dr.education.gouv.fr education.gouv.fr espace.gouv.fr recherche.gouv.fr technologie.fr technologie.gouv.fr ";
     
    #-------------------------------------------------------------------------------
    # BOUCLE DE CONNEXION AUX SERVEURS LDAP
    #-------------------------------------------------------------------------------
     
    my $ligne;
    my $ldap;
    my $host;
    my $mesg;
    my $dn;
    my $ui;
     
    my $ficout = "./toutesacademiesAdminPersDBF.fusion";
    my $ficerr = "./toutesacademiesAdminPersDBF.err";
    my $ficlog = "./toutesacademiesAdminPersDBF.log";
    my $ficscl="./toutesacademiesAdminPersDBF.pqs";
    my $ficDBF="./toutesacademiesAdminPersDBF.DBF.csv";
    my $ficBvAnnu="./bvannu.ldif";
    my $ficNumenNumind = "PERS_NUMIND_NUMEN.txt";
    my $ficCORRServRegion = "./CORR_SERV_REGION.csv";
    my $ficCSV="./RecherchePersDBF.CSV";
    my $ficzip="./toutesacademiesAdminPersDBF.zip";
    my $ficAliases="MessagerieDescartes.txt";
    my $ficPasTrouves = "./ListePasTrouvesDBF.csv";
    my $ficServices="SERVICE1.csv.UTF8";
    my $export_ANAIS="PERSONNE1.csv.UTF8";
    my $ficRespAdj = "REL_TITRE_RESPONSABLE.csv";
    my $ficNomenType = "type_structure.csv";
    my $ficDoublonNaissance = "DOUBLE_AFFECTATION.csv";
     
    my $ficLDIF="./Personnes.ldif";
    my $ficServicesLDIF="./Services.ldif";
    my $ficRolesLDIF="./Roles.ldif";
    open (LDIF,">$ficLDIF") || die ("Err054 fichier :\tImpossible de creer le fichier $ficLDIF");
    open (LDIF_SV,">$ficServicesLDIF") || die ("Err054 fichier :\tImpossible de creer le fichier $ficServicesLDIF");
    binmode LDIF_SV;
     
    #my $rootdn = "ou=adc,ou=education,o=gouv,c=fr";
    my $rootdn = "ou=structures,ou=adc,ou=education,o=gouv,c=fr";
    my %lstDescription;
    my %lstType;
    my %lstPosorg;
    my %lstNbRangs;
    my %lstNbRateaux;
    my %lstSeuil;
    my %lstColonne;
    my %lstAfficheSigleFin;
    my %lstCodeNiveau;
    my %lstCodeCouleur;
    my %lstParent;
    my %lstFonctions;
    my %lstrang;
    my %lstDN;
    my %lstrootDN;
    my %lstroleDN;
    my %lstroleCN;
    my %lstroleDNAutre;
    my %lstroleOU;
    my %lstroleOuDN;
    my %lstroleDESC;
    my @TabDN;
    $lstrootDN{""} = $rootdn;
    $lstrang{""} = 0;
    sub convLatin1_BASE64 {
            my($Ligne) = @_;
            $_=$Ligne;
            if (/[ÀÁÂÃÄÅaáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèeêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ]/) {
                    my @tab=split(/: /,$Ligne);
                    my $temp = latin1($tab[1]);
                    $temp = encode_base64($temp, "");
                    return "$tab[0]:: $temp";
            }
            else
                    {
    		return "$Ligne";
    	}
    }
    sub convUTF8_BASE64 {
            my($Ligne) = @_;
            $_=$Ligne;
            if (/[ÀÁÂÃÄÅaáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèeêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ]/) {
                    my @tab=split(/: /,$Ligne);
                    my $temp = latin1($tab[1])->utf8;
                    $temp = encode_base64($temp, "");
                    return "$tab[0]:: $temp";
            }
            else
                    {
    		return "$Ligne";
    	}
    }
    sub convBASE64 {
            my($Ligne) = @_;
            $_=$Ligne;
            if (/[ÀÁÂÃÄÅaáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèeêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ]/) {
                    my @tab=split(/: /,$Ligne);
                    my $temp = $tab[1];
    #                my $temp = latin1($tab[1])->utf8;
                    $temp = encode_base64($temp, "");
                    return "$tab[0]:: $temp";
            }
            else
                    {
    		return "$Ligne";
    	}
    }
     
    my %lstsiglesbureaux;
    open (LOG,">$ficlog") || die ("Err04 fichier :\tImpossible de creer le fichier $ficlog");
     
    sub DNParent {
    	my $code = $_[0];
    		if ($lstsiglesbureaux{$lstParent{$code}}) {
    			if (not $lstrootDN{$lstParent{$code}}) {DNParent($lstParent{$code});}
    			if ($lstrootDN{$lstParent{$code}}) {
    				my $tmprootDN_ = "ou=$lstsiglesbureaux{$code}";
    				my $tmprootDN = $tmprootDN_;
    				my $ext = 0;
                                    my $tmpext;
    				while ($lstDN{"$tmprootDN," . $lstrootDN{$lstParent{$code}}}) {
                                            $tmpext = $ext;
    					$tmprootDN = $tmprootDN_ . "-$ext";
    					$ext++;
    				}
                                    if (defined $tmpext) {$lstsiglesbureaux{$code} .= "-$tmpext";}
    				$lstrootDN{$code} = "$tmprootDN," . $lstrootDN{$lstParent{$code}};
    				$lstDN{$lstrootDN{$code}}++;
    				$lstrang{$code} = $lstrang{$lstParent{$code}} + 1;
    				$TabDN[$lstrang{$code}]{$code} = $lstrootDN{$code};
    			} else {
    				print LOG "Erreur CodeParent : $code, $lstsiglesbureaux{$code}, $lstParent{$code} \n";
    			}
    		}
    }
     
    my %lstLDIFmels;
    my %lstLDIFNomPatros;
    my %lstLDIFUserPasswords;
    my %lstLDIFCns;
    my %lstLDIFGivennames;
    my %lstLDIFSns;
    my %lstLDIFDns;
    my %lstLDIFUids;
    my %lstLDIFnoms;
    my %lstLDIFprenoms;
    my %lstLDIFtels;
    my %lstLDIFbureauxCode;
    my %lstLDIFbureaux;
    my %lstLDIFpieces;
    my %lstLDIFbatiments;
    my %lstLDIFCodecivilites;
    my %lstLDIFMatricules;
    my %lstLDIFrangs;
    my %lstLDIFmels_modif;
    my %lstLDIFTypensis;
    my %lstLDIFGradeNumbers;
    my %lstLDIFRgNumens;
    my %lstLDIFDateNaissances;
    my %lstLDIFRgNomPrenomMel;
    my %lstLDIFRgMel;
    my %lstLDIFRgNomPrenom;
     
    my %lstLDIFRgSOUCIMels;
    my %lstLDIFRgSOUCINomsPrenoms;
     
    open(FDDOUBLON, ">$ficDoublonNaissance") or die "immp d'ouv $ficDoublonNaissance en ecriture";
     
    my %lstRespRole;
    my %lstRespQual;
    my %lstRespResp;
    my %lstRespRang;
    my %lstRespAdj;
    my %lstRespSec;
    my %lstRespRang;
    open(FD_RA, "<$ficRespAdj") or die "immp d'ouv $ficRespAdj en lecture";
    while ($ligne=<FD_RA>) {
      chop $ligne;
      my @champs=split(/\|/,$ligne);
      my $intitule = $champs[0];
      if ($lstRespQual{$intitule} && $lstRespQual{$intitule} ne "") {
        print STDERR "ERREUR/RESP/Doublon:$intitule;$lstRespRole{$intitule}\n";
      }
      $lstRespQual{$intitule} = $champs[1];
      $lstRespRole{$intitule} = $champs[2];
      if (defined $champs[3] && $champs[3] !~ m/^\s*$/) {
        $lstRespRang{$intitule} = $champs[3];
      }
    print $intitule,":",$lstRespQual{$intitule},":",$lstRespRole{$intitule},":",$lstRespRang{$intitule},":","\n";
    }
    close(FD_RA);
    my %lstCodeRegion;
    open(FD_RA, "<$ficCORRServRegion") or die "immp d'ouv $ficCORRServRegion en lecture";
    while ($ligne=<FD_RA>) {
      chop $ligne;
      my @champs=split(/\|/,$ligne);
      my $code = lc($champs[0]);
      $code =~ s/(^\s+)|(\s+$)//g;
      my $region = $champs[3];
      $region =~ s/(^\s+)|(\s+$)//g;
      $lstCodeRegion{$code} = $region;
    }
    close(FD_RA);
     
    my %lstType;
    my %lstTypeNiveau;
    my %lstTypeCouleur;
    open(FD_RA, "<$ficNomenType") or die "immp d'ouv $ficNomenType en lecture";
    while ($ligne=<FD_RA>) {
      chop $ligne;
      $ligne =~ s/"//g;
      my @champs=split(/\|/,$ligne);
      my $type = uc($champs[0]);
      $type =~ s/(^\s*)|(\s*$)//g;
      $champs[1] =~ s/(^\s*)|(\s*$)//g;
      $champs[2] =~ s/(^\s*)|(\s*$)//g;
      $lstTypeNiveau{$type} = $champs[1];
      $lstTypeCouleur{$type} = $champs[2];
    }
    close(FD_RA);
     
     
    open(FD_BV, "<$ficBvAnnu") or die "impossible d'ouvrir le fichier $ficBvAnnu en lecture";
    my $LDIFRg = -1;
    while ($ligne=<FD_BV>) {
      chop $ligne;
      my @champs=split(/:/,$ligne);
      my $valeur = $champs[1];
      $valeur =~ s/^ *//;
      $valeur =~ s/ *$//;
      if ($ligne =~ /^dn:/) {
        if ($LDIFRg > 0) {
          if ($lstLDIFSns{$LDIFRg} && $lstLDIFGivennames{$LDIFRg} && $lstLDIFmels{$LDIFRg}) {
            my $chaine = lc("$lstLDIFSns{$LDIFRg}-$lstLDIFGivennames{$LDIFRg}-$lstLDIFmels{$LDIFRg}");
            if ($lstLDIFRgNomPrenomMel{$chaine}) {
    print "OOOOOO $lstLDIFRgNomPrenomMel{$chaine} pour $chaine\n";
            } else {
              $lstLDIFRgNomPrenomMel{$chaine} = $LDIFRg;
            }
          }
          if ($lstLDIFSns{$LDIFRg} && $lstLDIFGivennames{$LDIFRg}) {
            my $chaine = lc("$lstLDIFSns{$LDIFRg}-$lstLDIFGivennames{$LDIFRg}");
            if ($lstLDIFRgNomPrenom{$chaine}) {
    print "OOOO $lstLDIFRgNomPrenom{$chaine} pour $chaine\n";
              $lstLDIFRgSOUCINomsPrenoms{$chaine}++;
            } else {
              $lstLDIFRgNomPrenom{$chaine} = $LDIFRg;
            }
          }
          if ($lstLDIFmels{$LDIFRg}) {
            my $chaine = lc("$lstLDIFmels{$LDIFRg}");
            if ($lstLDIFRgMel{$chaine}) {
    print "OO $lstLDIFRgMel{$chaine} pour $chaine\n";
    if (defined $lstLDIFRgSOUCIMels{$chaine}) {
    #print "II $lstLDIFRgSOUCIMels{$chaine} [$chaine]\n";
      $lstLDIFRgSOUCIMels{$chaine} = $lstLDIFRgSOUCIMels{$chaine} . ", $lstLDIFSns{$LDIFRg} $lstLDIFGivennames{$LDIFRg}";
    } else {
      my $rang = $lstLDIFRgMel{$chaine}; 
      $lstLDIFRgSOUCIMels{$chaine} = "$lstLDIFSns{$rang} $lstLDIFGivennames{$rang}, $lstLDIFSns{$LDIFRg} $lstLDIFGivennames{$LDIFRg}";
    }
            } else {
              $lstLDIFRgMel{$chaine} = $LDIFRg;
            }
          }
        }
        $LDIFRg++;
        $lstLDIFDns{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^cn:/) {
        if ($lstLDIFCns{$LDIFRg}) {
          print STDERR "Erreur UID : Cn $valeur deja utilise ($ligne) -> $lstLDIFCns{$LDIFRg}, $LDIFRg\n";
        }
        $lstLDIFCns{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^sn:/) {
        $lstLDIFSns{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^givenname:/) {
        $lstLDIFGivennames{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^userpassword:/) {
        $lstLDIFUserPasswords{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^employeenumber:/) {
        $lstLDIFMatricules{$LDIFRg} = $valeur;
        $lstLDIFRgNumens{uc($valeur)} = $LDIFRg;
      } elsif ($ligne =~ /^datenaissance:/) {
        $lstLDIFDateNaissances{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^codecivilite:/) {
        $lstLDIFCodecivilites{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^grade:/) {
        $lstLDIFGradeNumbers{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^typensi:/) {
        $lstLDIFTypensis{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^uid:/) {
        if ($lstLDIFUids{$LDIFRg}) {
          print STDERR "Erreur UID : uid $valeur deja utilise ($ligne)\n";
        }
        $lstLDIFUids{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^nompatro:/) {
        $lstLDIFNomPatros{$LDIFRg} = $valeur;
      } elsif ($ligne =~ /^mailmondossier:/) {
        $lstLDIFmels{$LDIFRg} = $valeur;
      } elsif (!defined $lstLDIFmels{$LDIFRg} && $ligne =~ /^mail:/) {
        $lstLDIFmels{$LDIFRg} = $valeur;
      }
    }
    close(FD_BV);
        if ($LDIFRg > 0) {
          if ($lstLDIFSns{$LDIFRg} && $lstLDIFGivennames{$LDIFRg} && $lstLDIFmels{$LDIFRg}) {
            my $chaine = lc("$lstLDIFSns{$LDIFRg}-$lstLDIFGivennames{$LDIFRg}-$lstLDIFmels{$LDIFRg}");
            if ($lstLDIFRgNomPrenomMel{$chaine}) {
    print "OOOOOO $lstLDIFRgNomPrenomMel{$chaine} pour $chaine\n";
            } else {
              $lstLDIFRgNomPrenomMel{$chaine} = $LDIFRg;
            }
          }
          if ($lstLDIFSns{$LDIFRg} && $lstLDIFGivennames{$LDIFRg}) {
            my $chaine = lc("$lstLDIFSns{$LDIFRg}-$lstLDIFGivennames{$LDIFRg}");
            if ($lstLDIFRgNomPrenom{$chaine}) {
    print "OOOO $lstLDIFRgNomPrenom{$chaine} pour $chaine\n";
    		$lstLDIFRgSOUCINomsPrenoms{$chaine}++;
            } else {
              $lstLDIFRgNomPrenom{$chaine} = $LDIFRg;
            }
          }
          if ($lstLDIFmels{$LDIFRg}) {
            my $chaine = lc("$lstLDIFmels{$LDIFRg}");
            if ($lstLDIFRgMel{$chaine}) {
    print "OO $lstLDIFRgMel{$chaine} pour $chaine\n";
    if ($lstLDIFRgSOUCIMels{$chaine}) {
      $lstLDIFRgSOUCIMels{$chaine} = $lstLDIFRgSOUCIMels{$chaine} . ", $lstLDIFSns{$LDIFRg} $lstLDIFGivennames{$LDIFRg}";
    } else {
      my $rang = $lstLDIFRgMel{$chaine}; 
      $lstLDIFRgSOUCIMels{$chaine} = "$lstLDIFSns{$rang} $lstLDIFGivennames{$rang}, $lstLDIFSns{$LDIFRg} $lstLDIFGivennames{$LDIFRg}";
    }
            } else {
              $lstLDIFRgMel{$chaine} = $LDIFRg;
            }
          }
        }
     
    foreach my $clef (keys %lstLDIFRgSOUCIMels) {
      print LOG "Doublons-mels $clef -> $lstLDIFRgSOUCIMels{$clef}\n";
    }
    foreach my $clef (keys %lstLDIFRgSOUCINomsPrenoms) {
      if ($lstLDIFRgSOUCINomsPrenoms{$clef} >= 1 ) {print LOG "Doublons-noms-prenoms $clef -> $lstLDIFRgSOUCINomsPrenoms{$clef}\n";}
    }
     
    open(FD_SERV, "<$ficServices") or die "impossible d'ouvrir le fichier $ficServices en lecture";
    my $rg = 0;
    binmode FD_SERV;
    while ($ligne=<FD_SERV>) {
    	if ($. > 1) {
    		chop $ligne;
    		$ligne =~ s/\"//g;
    		my $academie = $ligne;
    		my @champs=split(/\|/,$academie);
    		$rg++;
    		my $code = lc($champs[0]);
    		my $code_parent = lc($champs[1]);
    		my $posorg = $champs[8];
    		my $type = uc($champs[9]);
    		my $nbrang = $champs[10];
    		my $nbrat = $champs[11];
    		my $afflib = $champs[12];
    		my $seuil = $champs[13];
    		my $colonne = $champs[14];
    		my $description = $champs[5];
    		my $sigle = lc($champs[4]);
                    $code =~ s/(^ +)|( +$)//g;
                    $code_parent =~ s/(^ +)|( +$)//g;
                    $description =~ s/(^ +)|( +$)//g;
                    $sigle =~ s/(^ +)|( +$)//g;
    if (!defined $sigle || $sigle =~ /^\s*$/) {
    print STDERR "$ligne\n";
    }
    		$lstsiglesbureaux{$code} = $sigle;
    #print "SIGLEPARENT : $code->$sigle \n";
    		$lstDescription{$code} = $description;
    		$lstType{$code} = $type;
                    if ($lstTypeNiveau{$type} && $lstTypeNiveau{$type} !~ m/^\s*$/) {
                      $lstCodeNiveau{$code} = $lstTypeNiveau{$type};
                    }
                    if ($lstTypeCouleur{$type} && $lstTypeCouleur{$type} !~ m/^\s*$/) {
                      $lstCodeCouleur{$code} = $lstTypeCouleur{$type};
                    }
    		$lstPosorg{$code} = $posorg;
    		$lstNbRangs{$code} = $nbrang;
    		$lstNbRateaux{$code} = $nbrat;
    		$lstAfficheSigleFin{$code} = $afflib;
    		$lstSeuil{$code} = $seuil;
    		$lstColonne{$code} = $colonne;
    		$lstParent{$code} = $code_parent;
    			if ($lstrootDN{$lstParent{$code}}) {
    				my $tmprootDN_ = "ou=$lstsiglesbureaux{$code}";
    				my $tmprootDN = $tmprootDN_;
    				my $ext = 0;
                                    my $tmpext;
    				while ($lstDN{"$tmprootDN," . $lstrootDN{$lstParent{$code}}}) {
                                            $tmpext = $ext;
    					$tmprootDN = $tmprootDN_ . "-$ext";
    					$ext++;
    				}
                                    if (defined $tmpext) {$lstsiglesbureaux{$code} .= "-$tmpext";}
    				$lstrootDN{$code} = "$tmprootDN," . $lstrootDN{$lstParent{$code}};
    				$lstDN{$lstrootDN{$code}}++;
    				$lstrang{$code} = $lstrang{$lstParent{$code}} + 1;
    				$TabDN[$lstrang{$code}]{$code} = $lstrootDN{$code};
    			}
    	} else {
              if ($ligne !~ /^CODESTR/) {
                print STDERR "Attention : il manque l'en-tete dans le fichier Services/Structures\n";
              }
            }
    }
    	foreach my $code (keys %lstsiglesbureaux) {
    		if (not $lstrootDN{$code}) { DNParent($code);}
    	}
     
    close FD_SERV;
     
    my %lstmels;
    my %lstnoms;
    my %lstprenoms;
    my %lsttels;
    my %lstbureauxCode;
    my %lstbureaux;
    my %lstpieces;
    my %lstdescriptions;
    my %lstNomPatros;
    my %lstnaissances;
    my %lstnomprenomnaissance;
    my %lstbatiments;
    my %lstgrades;
    my %lstsites;
    my %lstcivilites;
    my %lstmatricules;
    my %lstrangs;
    my %lstfaxs;
    my %lstmels_modif;
    my %nbhomonymes;
    my %nbhomonymesmels;
    my $rang = 0;
    my $academie;
    ##################
    open(FD_NUM, "<$ficNumenNumind") or die "impossible d'ouvrir le fichier $ficNumenNumind en lecture";
    my %lstNumindNumen;
    while ($ligne=<FD_NUM>) {
            $ligne =~ s/\"//g;
            chop $ligne;
            my $academie = $ligne;
            my @champs=split(/\|/,$academie);
            if ($. > 1) {
              my $Numind = $champs[99];
              $Numind =~ s/(^\s+)|(\s+$)//g;
              my $Numen = $champs[6];
              $Numen =~ s/(^\s+)|(\s+$)//g;
              if ($Numen =~ m/^\s*$/ || $Numind =~ m/^\s*$/) {
                print FDLOG "ERR/NumindNumen : non defini [$Numind,$Numen]\n";
              }
              if ($lstNumindNumen{$Numind}) {
                print FDLOG "ERR/NumindNumen : $Numind a deja un numen $Numen\n";
              }
              $lstNumindNumen{$Numind} = uc($Numen);
            }
    }
    close(FD_NUM);
    ##################
    open (PTLOG,">$ficPasTrouves") || die ("Err054 fichier :\tImpossible de creer le fichier $ficPasTrouves");
    open (CSV,">$ficCSV") || die ("Err054 fichier :\tImpossible de creer le fichier $ficCSV");
    #binmode CSV;
    open (DBF,">$ficDBF") || die ("Err054 fichier :\tImpossible de creer le fichier $ficDBF");
     
     
     
    open(FD_ACAD, "<$export_ANAIS") or die "impossible d'ouvrir le fichier academies.txt en lecture";
     
    while ($ligne=<FD_ACAD>) {
    	$ligne =~ s/\"//g;
    	chop $ligne;
    	#my $academie = lc($ligne);
    	my $academie = $ligne;
    	my @champs=split(/\|/,$academie);
    if ($. > 1) {
    	$rang++;
    	$lstmels{$rang} = $champs[106];
    	if (($champs[106] && $champs[106] ne "") && !Email::Valid->rfc822($champs[106])) {
    		print LOG "Error ANAIS :\tmail invalide [".$champs[106]."] pour $champs[101],$champs[102] dans EXPORT_ANAIS\n";
    		$lstmels_modif{$rang} = 1;
    	}
    	if ($champs[101] =~ /^[[:space:]]*$/) {
            	if (!($champs[1] =~ /^[[:space:]]*$/ || $champs[99] =~ /^[[:space:]]*$/)) {
            		print LOG "Error ANAIS :\tnom invalide [".$champs[101]."] pour $champs[101],$champs[102] a $rang ligne, dans EXPORT_ANAIS\n";
    	        	print STDERR "Error ANAIS :\tnom invalide [".$champs[101]."] pour $champs[101],$champs[102] a $rang ligne, dans EXPORT_ANAIS\n";
                    }
            }
            else {
    	$lstnoms{$rang} = $champs[101];
    	$lstgrades{$rang} = $champs[103];
    	$lstprenoms{$rang} = $champs[102];
    	$lstmatricules{$rang} = lc($champs[99]);
    	$lstcivilites{$rang} = lc($champs[99]);
    	$lstpieces{$rang} = $champs[13];
            $lstdescriptions{$rang} = $champs[4];
    	$lstNomPatros{$rang} = $champs[2];
    	$lstnaissances{$rang} = $champs[5];
            my $nomprenomnaissance = "$champs[101] $champs[102] $champs[5]";
            my $tmpExiste = $lstnomprenomnaissance{$nomprenomnaissance};
            if ($nomprenomnaissance && $nomprenomnaissance !~ m/^\s*$/ && $tmpExiste && $tmpExiste !~ m/^\s*$/) {
              print STDERR "ERREUR/Doublon/Naissance: $tmpExiste;$champs[99];$nomprenomnaissance\n";
              print FDDOUBLON "$tmpExiste;$champs[99];$lstnoms{$rang};$lstprenoms{$rang};$lstnaissances{$rang}\n";
            } else {
              $lstnomprenomnaissance{$nomprenomnaissance} = $lstmatricules{$rang};
            }
    	$lstbatiments{$rang} = $champs[14];
            $lstbatiments{$rang} =~ s/(^\s*)|(\s*$)//g;
    	$lstsites{$rang} = $champs[24];
    	$lstbureauxCode{$rang} = $champs[1];
    	my $Fonction = $champs[3];
    	$lstFonctions{$rang} = $Fonction;
    	$lstbureaux{$rang} = $lstsiglesbureaux{lc($champs[1])};
    	$lsttels{$rang} = $champs[7];
    	$lstcivilites{$rang} = $champs[8];
    	$lstfaxs{$rang} = $champs[11];
    	$nbhomonymes{"$champs[101]$champs[102]"}++;
    	$nbhomonymesmels{"$champs[106]"}++;
    ###### RAJOUT 10/03/2004
           print CSV $lstmels{$rang} . "|" . $lsttels{$rang} . "|||||" . $lstnoms{$rang} . "|" .$lstprenoms{$rang} . "|" . $lstbureaux{$rang} . "|" . $lstDescription{$lstbureauxCode{$rang}} . "|" . $Fonction . "|" . $lstpieces{$rang} . "|" . $lstbatiments{$rang} . "|" . $lstsites{$rang} . "||" . "\n";
    ##########
     
     
    	if ($nbhomonymes{"$champs[101]$champs[102]"}>1) {
    		if ($nbhomonymes{"$champs[101]$champs[102]"} ne $nbhomonymesmels{"$champs[106]"}) { print LOG $nbhomonymes{"$champs[101]$champs[102]"} . " * HOMONYMES POTENTIELS :\t" . "$champs[101] $champs[102]\n";}
    		else {print LOG $nbhomonymes{"$champs[101]$champs[102]"} . " * HOMONYMES A PRIORI FAUX :\t" . "$champs[101] $champs[102]\n";}
    	}
    #	print $rang . $lstmels[$rang] . $lstnoms[$rang] . $lstprenoms[$rang] . $lsttels[$rang] . "\n";
    	}
    	}
    	else {print DBF "$champs[99]|$champs[101]|$champs[102]|$champs[7]|$champs[106]\n";}
    }
    print "Nom_ANAIS\tPrenom_ANAIS\tTel_ANAIS\tMel_ANAIS\tComp_Mel\tComp_Tel\tComp_Prenom\tNom_Messagerie\tPrenom_Messg\tMel_Messg\tTel_Messg\tEquiv_Messg\tMel_Recherche\tMel_Aliases\tMiseAJour\tProbabilite\n";
     
     
    ################
    # ATTENTION aux valeurs multiples!!!
    ################
    print LOG "Ca demarre\n";
     
    foreach my $clef (keys %lstnoms) {
    my %listeLDAPtrouvesinv;
    my $LDAPouALIASEStrouve;
    	my $MaJ = 0;
    	my $MaJtemp = 0;
            my $ValidEmail = 0;
    	my $nom = $lstnoms{$clef};
     
     
    	my $telMODIF = "";
    	my $mailMODIF = "";
    	my $prenom = $lstprenoms{$clef};
    	my $bureauCodeMAJ = $lstbureauxCode{$clef};
    	my $bureauCode = lc($bureauCodeMAJ);
    	my $bureau = $lstbureaux{$clef};
    	my $piece = $lstpieces{$clef};
            my $description = $lstdescriptions{$clef};
    	my $Title = $lstFonctions{$clef};
    	my $tempDN;
    	my $site = $lstsites{$clef};
    	my $nompatro = $lstNomPatros{$clef};
    	my $naissance = $lstnaissances{$clef};
    	my $batiment = $lstbatiments{$clef};
    	my $civilite = $lstcivilites{$clef};
    	my $matricule = $lstmatricules{$clef};
    	my $mel = $lstmels{$clef};
    	my $filtre="$nom";
     
    	my $grade = $lstgrades{$clef};
    	my $fax = format_tel($lstfaxs{$clef});
    	my $telephone = $lsttels{$clef};
    	my $teleph = format_tel($telephone);
    	my $telephone_modif;
    	my $mel_modif = $lstmels_modif{$clef};
    	if (defined $telephone && $telephone ne "" && $telephone !~ /^[[:digit:]][[:digit:]]\.[[:digit:]][[:digit:]]\.[[:digit:]][[:digit:]]\.[[:digit:]][[:digit:]]\.[[:digit:]][[:digit:]]$/) {
    		print LOG "Error ANAIS :\ttel invalide [".$telephone."]pour $prenom,$nom,$mel\n";
    		print LOG "Error ANAIS :\ttel invalide [".$telephone."]pour $prenom,$nom,$mel\n";
    		if ($teleph eq $telephone) {
    			$telephone_modif = 1;
    		} elsif ($teleph =~ /^[[:digit:]][[:digit:]]\.[[:digit:]][[:digit:]]\.[[:digit:]][[:digit:]]\.[[:digit:]][[:digit:]]\.[[:digit:]][[:digit:]]$/) {
    			$MaJtemp += 1;	
    		} else {
    			 $telephone_modif = 2;
    		}
    	}
    	$telephone = $teleph;
     
    ######## FIN ALIAS

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Décembre 2005
    Messages
    27
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2005
    Messages : 27
    Par défaut
    Part2
    -----

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
     
    	my ($street, $PostalCode, $Location) = split " - ", $site;
    	my $TestExisteBureauDN;
    	$TestExisteBureauDN = 1;
    	if ($lstrootDN{$bureauCode} && $lstrootDN{$bureauCode} ne "") {
    		$TestExisteBureauDN = 1;
    	} else {
    		print LOG "Erreur DN : absence de bureau parent dont le code pour $nom $prenom est $bureauCode\n";
    		print LOG "($lstrootDN{$bureauCode})\n";
    	}
    if ($TestExisteBureauDN) {
    #	$tempDN = convBASE64("dn: cn=$nom $prenom," . $lstrootDN{$bureauCode});
    #	$tempDN = "cn=$nom $prenom," . $lstrootDN{$bureauCode};
            my $rang;
            my $Numind = $matricule;
            my $Numen;
            if (defined $lstNumindNumen{$Numind} && $lstNumindNumen{$Numind} !~ m/^\s$/) {
               $rang = $lstLDIFRgNumens{$lstNumindNumen{$Numind}};
               $Numen = $lstNumindNumen{$Numind};
            } else {
              undef $rang;
            }
     
    #######
         if (!defined $rang) {
    print LOG "AVERTSST/MATRICULE : $nom;$prenom;$mel;$matricule n'a pas d'equivalent matricule dans infocentre MDRH\n";
            my $chaine1;
            my $chaine11;
            my $chaine12;
            my $chaine2;
            my $chaine3;
            my $chaine4;
            my $chaine5;
            if (defined $mel && $mel ne "") {$chaine1 = lc("$nom-$prenom-$mel");}
            if (defined $mel && $mel ne "") {$chaine11 = lc("$nom-$prenom-$mel");$chaine11 =~ s/ /-/g;}
            if (defined $mel && $mel ne "") {$chaine12 = lc("$nom-$prenom-$mel");$chaine12 =~ s/ /-/g;$chaine12 =~ s/'/-/g;}
            if (defined $mel && $mel ne "") {$chaine2 = lc("$mel");}
            if (defined $nom && $nom ne "") {$chaine3 = lc("$nom-$prenom");}
            if (defined $nom && $nom ne "") {$chaine4 = lc("$nom-$prenom");$chaine4 =~ s/ /-/g;}
            if (defined $nom && $nom ne "") {$chaine5 = lc("$nom-$prenom");$chaine5 =~ s/ /-/g;$chaine5 =~ s/'/-/g;}
    #        if ($lstLDIFRgNomPrenomMel{$chaine}) {
    ###
    #        my $rang;
            if (defined $lstLDIFRgNomPrenomMel{$chaine1} && defined $chaine1) {
              $rang = $lstLDIFRgNomPrenomMel{$chaine1};
    print LOG "CH1 : $nom, $prenom, $mel / $chaine1 -> $rang\n"; 
            } elsif (defined $lstLDIFRgMel{$chaine11} && defined $chaine11) {
              $rang = $lstLDIFRgNomPrenomMel{$chaine11};
    print LOG "CH11 : $nom, $prenom, $mel / $chaine1 -> $rang\n"; 
            } elsif (defined $lstLDIFRgMel{$chaine12} && defined $chaine12) {
              $rang = $lstLDIFRgNomPrenomMel{$chaine12};
    print LOG "CH12 : $nom, $prenom, $mel / $chaine1 -> $rang\n"; 
            } elsif (defined $lstLDIFRgMel{$chaine2} && defined $chaine2) {
              $rang = $lstLDIFRgMel{$chaine2};
              if ($lstLDIFRgSOUCIMels{$chaine2}) {
    print LOG "CH2 Risque : $nom, $prenom, $mel / $chaine2 -> $rang\n"; 
              } else {
    print LOG "CH2 : $nom, $prenom, $mel / $chaine2 -> $rang\n"; 
              }
            } elsif (defined $lstLDIFRgNomPrenom{$chaine3} && defined $chaine3) {
              if ($lstLDIFRgSOUCINomsPrenoms{$chaine3}) {
    print LOG "CH3 Risque : $nom, $prenom, $mel / $chaine3 -> $rang\n"; 
              } else {
    print LOG "CH3 : $nom, $prenom, $mel / $chaine3 -> $rang\n"; 
              }
              $rang = $lstLDIFRgNomPrenom{$chaine3};
            } elsif (defined $lstLDIFRgNomPrenom{$chaine4} && defined $chaine4) {
              $rang = $lstLDIFRgNomPrenom{$chaine4};
              if ($lstLDIFRgSOUCINomsPrenoms{$chaine4}) {
    print LOG "CH4 Risque : $nom, $prenom, $mel / $chaine4 -> $rang\n"; 
              } else {
    print LOG "CH43 : $nom, $prenom, $mel / $chaine4 -> $rang\n"; 
              }
            } elsif (defined $lstLDIFRgNomPrenom{$chaine5} && defined $chaine5) {
              $rang = $lstLDIFRgNomPrenom{$chaine5};
              if ($lstLDIFRgSOUCINomsPrenoms{$chaine5}) {
    print LOG "CH5 Risque : $nom, $prenom, $mel / $chaine5 -> $rang\n"; 
              } else {
    print LOG "CH5 : $nom, $prenom, $mel / $chaine5 -> $rang\n"; 
              }
            } else {
    print LOG "CH : $nom, $prenom, $mel n'a pas d'equivalent matricule\n"; 
    #          undef $rang;
            }
        }
    #######
     
            if (defined $rang && $lstLDIFUids{$rang}) {
    #	  $tempDN = "cn=$nom $prenom + uid=$lstLDIFUids{$rang}," . "ou=centrale,ou=personnes,ou=adc,ou=education,o=gouv,c=fr";
    	  $tempDN = "cn=$nom $prenom," . "ou=centrale,ou=personnes,ou=adc,ou=education,o=gouv,c=fr";
            } else {
    	  $tempDN = "cn=$nom $prenom," . "ou=centrale,ou=personnes,ou=adc,ou=education,o=gouv,c=fr";
            }
     
    	print LDIF "dn: $tempDN" . "\n";
    	print LDIF "objectClass: top" . "\n";
    	print LDIF "objectClass: person" . "\n";
    	print LDIF "objectClass: organizationalPerson" . "\n";
    	print LDIF "objectClass: inetOrgPerson" . "\n";
    	print LDIF "objectClass: frEduPerson" . "\n";
    #	print LDIF "objectClass: frEduPenPerson" . "\n";
    	print LDIF "objectClass: frEduOrgPerson" . "\n";
    	print LDIF "objectClass: frEduAdcPerson" . "\n";
     
    # RAJOUT du 10/03/2006
    my $orgunit;
    if ($bureauCode && $bureauCode ne "") {
    ######################
    	print LDIF "ou: " . uc($bureau) . "\n";
    	$orgunit = $bureau;
            my $dir = $orgunit; 
            my $bur; 
            my $position;
            if ($dir =~ m/ /g) {
              $position = pos $dir;
              $dir = substr($orgunit,0,$position - 1); 
              $bur = substr($orgunit,$position); 
            } else {
              $bur = $dir;
            }
    	if ($bur) {print LDIF "frEduBureau: " . uc($bur)  . "\n";} else {print LDIF "frEduBureau: ". uc($dir)  . "\n";}
    	print LDIF "frEduDirection: " . uc($dir)  . "\n";
    }
            if ($nom && $nom ne "") {print LDIF "sn: $nom"  . "\n";}
            if ($prenom && $prenom ne "") {print LDIF "givenname: $prenom"  . "\n";}
            if ($nom && $nom ne "") {print LDIF "cn: $nom $prenom"  . "\n";}
            if ($piece && $piece ne "") {print LDIF "roomnumber: $piece"  . "\n";}
            if ($description && $description ne "") {print LDIF "description: $description"  . "\n";}
            if ($Title && $Title ne "" && $Title !~ /^ *\.+ *$/) {
    		print LDIF "title: $Title"  . "\n";
    # RAJOUT du 10/03/2006
    if ($bureauCode && $bureauCode ne "") {
    ######################
    if ($lstRespRole{$Title} && $lstRespRole{$Title} ne "") {
                    my $tempTitle = $lstRespRole{$Title};
                    my $tempRoleDN = "cn=$tempTitle," . $lstrootDN{$bureauCode};
    #                $lstroleCN{$tempRoleDN} = $tempTitle;
                    $lstroleCN{$tempRoleDN} = "$tempTitle frEduCodeStr $bureauCode";
    #                my $tempRoleDNAutre = "cn=$tempTitle+frEduCodeStr=$bureauCode,ou=roles,ou=adc,ou=education,o=gouv,c=fr";
                    my $tempRoleDNAutre = "cn=$tempTitle frEduCodeStr $bureauCode,ou=roles,ou=adc,ou=education,o=gouv,c=fr";
                    $lstroleDNAutre{$tempRoleDN} = $tempRoleDNAutre;
                    $lstroleOU{$tempRoleDN} = $orgunit;
                    $lstroleOuDN{$tempRoleDN} = "$lstrootDN{$bureauCode}";
                    $lstroleDESC{$tempRoleDN} = $tempTitle;
                    $lstroleDN{$tempRoleDN} .= "roleOccupant: $tempDN" . "\n";
    		print LDIF "frEduRoleDN: $tempRoleDNAutre"  . "\n";
                    if ($lstRespQual{$Title} =~ /^RESP$/){
    print "YYYY:$Title;$lstRespQual{$Title};$bureauCode;$lstParent{$bureauCode};$tempDN;$lstRespRang{$Title};$lstRespRang{$bureauCode}\n";
                      if (defined $lstRespRang{$Title} && $lstRespRang{$Title} > 0) {
                        if (!defined $lstRespRang{$bureauCode} || ($lstRespRang{$Title} < $lstRespRang{$bureauCode})) {
                          $lstRespResp{$bureauCode} = "frEduResponsable: $tempDN" . "\n";
                          $lstRespRang{$bureauCode} = $lstRespRang{$Title};
                        }
                      }
                    } elsif ($lstRespQual{$Title} =~ /^ADJ$/){ 
                      $lstRespAdj{$bureauCode} .= "frEduResponsableAdj: $tempDN" . "\n";
                    } elsif ($lstRespQual{$Title} =~ /^SEC$/){
                      $lstRespSec{$bureauCode} .= "frEduSecretaire: $tempDN" . "\n";
                    } elsif ($lstRespQual{$Title} =~ /^RESPADJ$/){
    print "AAAA:$Title;$lstRespQual{$Title};$bureauCode;$lstParent{$bureauCode};$tempDN\n";
    print "BBBB:$Title;$lstRespResp{$bureauCode};$lstRespAdj{$lstParent{$bureauCode}}\n";
                      if (defined $lstRespRang{$Title} && $lstRespRang{$Title} > 0) {
                        if (!defined $lstRespRang{$bureauCode} || ($lstRespRang{$Title} < $lstRespRang{$bureauCode})) {
                          $lstRespResp{$bureauCode} = "frEduResponsable: $tempDN" . "\n";
                          $lstRespRang{$bureauCode} = $lstRespRang{$Title};
                          $lstRespAdj{$lstParent{$bureauCode}} .= "frEduResponsableAdj: $tempDN" . "\n";
                        } else {
                          $lstRespAdj{$bureauCode} .= "frEduResponsableAdj: $tempDN" . "\n";
                        }
                      }
    print "CCCC:$Title;$lstRespResp{$bureauCode};$lstRespAdj{$lstParent{$bureauCode}}\n";
                    } elsif ($lstRespQual{$Title} =~ /^$/){
                    } else {print "PORBLEME\n"};
    }
    }
    	}
            if ($Location && $Location ne "") {print LDIF "l: $Location"  . "\n";}
            if ($PostalCode && $PostalCode ne "") {print LDIF "postalcode: $PostalCode"  . "\n";}
            if ($site && $site ne "") {
              print LDIF "postaladdress: $site"  . "\n";
            }
            if ($street && $street ne "") {print LDIF "street: $street"  . "\n";}
            if ($bureauCode && $bureauCode ne "") {print LDIF "departmentNumber: $bureauCodeMAJ"  . "\n";}
            if ($fax && $fax ne "") {print LDIF "facsimileTelephoneNumber: $fax"  . "\n";}
            if ($batiment && $batiment ne "") {print LDIF "houseidentifier: $batiment"  . "\n";}
            if ($telephone && $telephone ne "" && ($TestExisteBureauDN)) {print LDIF "telephonenumber: $telephone"  . "\n";}
            if ($mel && $mel ne "" && ($TestExisteBureauDN)) {
              print LDIF "mail: $mel"  . "\n";
    #cnci.univ-paris5.fr
    #cne-evaluation.fr
    #dr.education.gouv.fr
    #eduaction.gouv.fr
    #education
    #education.gouv.f
    #education.gouv.fr
    #espace.gouv.fr
    #iuf.cpu.fr
    #jeunesse-sports.gouv.fr
    #recherche.gouv.fr
    #technologie.fr
    #technologie.gouv.fr
              my $chSuffixe = $mel;
              $chSuffixe =~ s/^[^@]+@//;
    #          if ($chSuffixesMels =~ / $chSuffixe /) {
    #            print LDIF "mailHost: adc1.adc.education.fr"  . "\n";
    #            print LDIF "mailLocalAddress: $mel"  . "\n";
    #          }
            }
    ###
     
            if (defined $rang) {
     
    #        if (defined $lstLDIFRgNumens{$matricule}) {
    #          my $rang = $lstLDIFRgNumens{$matricule};
              if ($lstLDIFUids{$rang}) {print LDIF "uid: $lstLDIFUids{$rang}" . "\n";          } else {print LOG "AAAAAA $nom, $prenom, $matricule n'a pas d'uid\n";}
              if ($lstLDIFUserPasswords{$rang}) {print LDIF "userPassword: $lstLDIFUserPasswords{$rang}" . "\n";          }
              if ($civilite) {print LDIF "personalTitle: $civilite" . "\n";} 
    #elsif ($lstLDIFCodecivilites{$rang}) {print LDIF "personalTitle: $lstLDIFCodecivilites{$rang}" . "\n";}
     
              if ($nompatro && $nompatro !~ m/^\s*$/) {
                print LDIF "frEduAdcNomPatro: $nompatro" . "\n";
              } else {
                if ($lstLDIFNomPatros{$rang}) {print LDIF "frEduAdcNomPatro: $lstLDIFNomPatros{$rang}" . "\n";          }
              }
              if ($lstLDIFGradeNumbers{$rang}) {print LDIF "frEduAdcGradeNumber: $lstLDIFGradeNumbers{$rang}" . "\n";          }
              if ($lstLDIFDateNaissances{$rang}) {
                print LDIF "frEduAdcDateNaissance: $lstLDIFDateNaissances{$rang}" . "\n";
                if ($naissance && $naissance !~ m/^\s*$/ && $lstLDIFDateNaissances{$rang} ne $naissance) {
                  print STDERR "ERREUR/DIFF_NAISSANCE: $matricule,$nom,$prenom,$naissance,$lstLDIFDateNaissances{$rang}\n";
                }
              } else {
                if ($naissance && $naissance !~ m/^\s*$/) {
                  print LDIF "frEduAdcDateNaissance: $naissance" . "\n";
                }
              }
              if ($lstLDIFTypensis{$rang}) {print LDIF "frEduAdcTypensi: $lstLDIFTypensis{$rang}" . "\n";}
            } else {
              print "ERREUR NUMEN: $nom $matricule n'a pas d'equivalent LDIF MDRH\n";
              if ($nompatro && $nompatro !~ m/^\s*$/) {
                print LDIF "frEduAdcNomPatro: $nompatro" . "\n";
              }
              if ($naissance && $naissance !~ m/^\s*$/) {
                print LDIF "frEduAdcDateNaissance: $naissance" . "\n";
              }
            }
            if ($mel && $mel ne "" && ($TestExisteBureauDN)) {
              $mel =~ s/\@/\./;
              print LDIF "eduPersonPrincipalName:  $mel"  . "\n";
            }
            if ($grade && $grade ne "") {print LDIF "frEduAdcGrade: $grade" . "\n";}
            if ($site && $site ne "") {
              print LDIF "frEduAdcSite: $site"  . "\n";
            }
    # RAJOUT du 10/03/2006
    if ($bureauCode && $bureauCode ne "") {
    ######################
    	print LDIF "frEduAdcOUDN: " . $lstrootDN{$bureauCode} . "\n";
    	print LDIF "frEduAdcOUEffectiveDN: " . $lstrootDN{$bureauCode} . "\n";
    }
    	print LDIF "frEduAdcSource: " . "Anais, MDRH" . "\n";
            if ($lstLDIFMatricules{$rang} && $lstLDIFMatricules{$rang} ne "") {
              print LDIF "frEduAdcNumen: " . SeedHASH(uc($lstLDIFMatricules{$rang}))  . "\n";
            } elsif ($Numen && $Numen ne "") {
              print LDIF "frEduAdcNumen: " . SeedHASH(uc($Numen))  . "\n";
            }
            if ($matricule && $matricule ne "") {print LDIF "frEduAdcNumind: " . $matricule  . "\n";}
            print LDIF "frEduAdcStatut: validated" . "\n";
     
            print LDIF "\n";
    }
    }
     
    ##################################################
    for my $i ( 0 .. $#TabDN ) {
        for my $code ( keys %{ $TabDN[$i] } ) {
    #	print LDIF_SV convUTF8_BASE64("dn: " . $lstrootDN{$code}) . "\n";
    	print LDIF_SV "dn: " . $lstrootDN{$code} . "\n";
    	print LDIF_SV "objectClass: top" . "\n";
    	print LDIF_SV "objectClass: OrganizationalUnit" . "\n";
    #	print LDIF_SV "objectClass: frEduOrgUnit" . "\n";
    	print LDIF_SV "objectClass: frEduOrg" . "\n";
    	print LDIF_SV "objectClass: frEduAdcOrganizationalUnit" . "\n";
    #	print LDIF_SV "objectClass: frEduAdcOrganizationalUnit" . "\n";
    	print LDIF_SV "frEduAdcCODESTR: $code" . "\n";
    	if ($lstRespResp{$code}) {print LDIF_SV $lstRespResp{$code};}
    	if ($lstRespSec{$code}) {print LDIF_SV $lstRespSec{$code};}
    	if ($lstRespAdj{$code}) {print LDIF_SV $lstRespAdj{$code};}
    	if ($lstParent{$code}) {print LDIF_SV "frEduAdcParentCODESTR: $lstParent{$code}" . "\n";}
    #	print LDIF_SV convBASE64("ou: $lstsiglesbureaux{$code}") . "\n";
    #	print LDIF_SV convBASE64("displayName: $lstDescription{$code}") . "\n";
    #	print LDIF_SV convBASE64("description: $lstDescription{$code}") . "\n\n";
    	print LDIF_SV "ou: " . uc($lstsiglesbureaux{$code}) . "\n";
    	print LDIF_SV "displayName: $lstDescription{$code}" . "\n";
    	print LDIF_SV "description: $lstDescription{$code}" . "\n";
    	if (defined $lstCodeRegion{$code} && $lstCodeRegion{$code} ne "") {print LDIF_SV "frEduRegion: $lstCodeRegion{$code}" . "\n";}
    	if (defined $lstPosorg{$code} && $lstPosorg{$code} ne "") {print LDIF_SV "frEduAdcPosorg: $lstPosorg{$code}" . "\n";}
    	if ($lstCodeCouleur{$code}) {print LDIF_SV "frEduAdcStructCouleur: $lstCodeCouleur{$code}" . "\n";}
    	if ($lstCodeNiveau{$code} && $lstCodeNiveau{$code} !~ m/NUL/i) {print LDIF_SV "frEduAdcStructNiveau: $lstCodeNiveau{$code}" . "\n";}
    	if ($lstType{$code}) {print LDIF_SV "frEduAdcStructType: $lstType{$code}" . "\n";}
    	if ($lstNbRangs{$code}) {print LDIF_SV "frEduAdcNbRangsAff: $lstNbRangs{$code}" . "\n";}
    	if ($lstNbRateaux{$code}) {print LDIF_SV "frEduAdcNbRateauxAff: $lstNbRateaux{$code}" . "\n";}
    	if ($lstAfficheSigleFin{$code}) {print LDIF_SV "frEduAdcAfficheSigleFin: $lstAfficheSigleFin{$code}" . "\n";}
    	if ($lstSeuil{$code}) {print LDIF_SV "frEduAdcStructSeuil: $lstSeuil{$code}" . "\n";}
    	if ($lstColonne{$code}) {print LDIF_SV "frEduAdcStructCol: $lstColonne{$code}" . "\n";}
    	print LDIF_SV "\n";
     
    #	my $temp = $lstrootDN{$code};
    #	$temp =~ s/ou *= *Entites administratives/ou=Fonctions/;
    #	print LDIF_SV convUTF8_BASE64("dn: " . $temp) . "\n";
    #	print LDIF_SV "objectClass: top" . "\n";
    #	print LDIF_SV "objectClass: OrganizationalUnit" . "\n";
    #	print LDIF_SV convBASE64("ou: $lstsiglesbureaux{$code}") . "\n";
    #	print LDIF_SV convBASE64("description: $lstDescription{$code}") . "\n\n";
        }
    }
     
    #foreach my $clef (keys %lstroleDN) {
    #        print LDIF_SV "dn: $clef" . "\n";
    #        print LDIF_SV "objectClass: top" . "\n";
    #        print LDIF_SV "objectClass: organizationalRole" . "\n";
    #        print LDIF_SV "objectClass: frEduOrgFonc" . "\n";
    #        print LDIF_SV "objectClass: frEduOrgAdcRole" . "\n";
    #        print LDIF_SV "cn: $lstroleCN{$clef}" . "\n";
    #        print LDIF_SV "description: $lstroleDESC{$clef}" . "\n";
    #        print LDIF_SV $lstroleDN{$clef};
    #        print LDIF_SV "\n";
    #}
    ##################################################
    close LDIF;
    open (LDIF_RL,">$ficRolesLDIF") || die ("Err054 fichier :\tImpossible de creer le fichier $ficRolesLDIF");
    foreach my $clef (keys %lstroleDN) {
            print LDIF_RL "dn: $lstroleDNAutre{$clef}" . "\n";
            print LDIF_RL "objectClass: top" . "\n";
            print LDIF_RL "objectClass: organizationalRole" . "\n";
            print LDIF_RL "objectClass: frEduOrgFonc" . "\n";
            print LDIF_RL "objectClass: frEduOrgAdcRole" . "\n";
            print LDIF_RL "cn: $lstroleCN{$clef}" . "\n";
            print LDIF_RL "ou: " . uc($lstroleOU{$clef}) . "\n";
            print LDIF_RL "frEduInclusDN: $lstroleOuDN{$clef}" . "\n";
            print LDIF_RL "frEduInclusEtendue: Base" . "\n";
            print LDIF_RL "description: $lstroleDESC{$clef}" . "\n";
            print LDIF_RL $lstroleDN{$clef};
            print LDIF_RL "\n";
    }
    close LDIF_RL;
    Merci d'avance

Discussions similaires

  1. vb.net openfiledialog introuvable
    Par Alex35 dans le forum VB.NET
    Réponses: 2
    Dernier message: 03/01/2008, 11h06
  2. VB .Net 2003 - DLL - point d'entrée introuvable
    Par Malebogia dans le forum Windows Forms
    Réponses: 3
    Dernier message: 05/09/2006, 18h04
  3. [c#.net] controle introuvable
    Par mahboub dans le forum Windows Forms
    Réponses: 6
    Dernier message: 18/07/2006, 10h56
  4. [PLUG IN HIBERNATE] introuvable sur le net
    Par PamelaGeek dans le forum Eclipse Java
    Réponses: 11
    Dernier message: 02/01/2006, 18h35
  5. [VB.NET] pilote ISAM introuvable
    Par cc85 dans le forum Windows Forms
    Réponses: 1
    Dernier message: 10/04/2005, 23h24

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo