Retrieves ax last modification date if more recent than ours.
authorStéphane Jacob <sj@m4x.org>
Sun, 12 Dec 2010 20:10:21 +0000 (21:10 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 13 Dec 2010 00:00:12 +0000 (01:00 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/fusionax/Activites.sql
modules/fusionax/Adresses.sql
modules/fusionax/Anciens.sql
modules/fusionax/Formations.sql
modules/fusionax/formation.pl
upgrade/1.0.1/merge.php

index e412b15..03c3449 100644 (file)
@@ -9,6 +9,7 @@ CREATE TABLE IF NOT EXISTS `fusionax_activites` (
   `Raison_sociale` VARCHAR(255) NOT NULL COMMENT 'Raison sociale de l''établissement',
   `Libelle_fonctio` VARCHAR(255) NOT NULL COMMENT 'Libéllé de la fonction',
   `Annuaire` BOOLEAN NOT NULL COMMENT 'publiable dans l''annuaire papier',
+  `Date_maj` DATE NOT NULL COMMENT 'Date de mise à jour de ces informations',
   pid INT(11) UNSIGNED DEFAULT NULL,
   jobid INT(6) UNSIGNED DEFAULT NULL,
   description VARCHAR(255) DEFAULT NULL,
@@ -20,7 +21,9 @@ CREATE TABLE IF NOT EXISTS `fusionax_activites` (
 
 LOAD DATA LOCAL INFILE '{?}Activites.txt' INTO TABLE `fusionax_activites` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (AC, ax_id, Code_etab, Raison_sociale, Libelle_fonctio, Annuaire,
-@Ligne1, @Ligne2, @Ligne3, @code_postal, @ville, @zip_cedex, @etat_distr, @pays, @tel, @fax, @StringDate_maj);
+@Ligne1, @Ligne2, @Ligne3, @code_postal, @ville, @zip_cedex, @etat_distr, @pays, @tel, @fax, @StringDate_maj)
+SET
+`Date_maj` = CONCAT(SUBSTRING(@StringDate_maj,7),'-',SUBSTRING(@StringDate_maj,4,2),'-',SUBSTRING(@StringDate_maj,1,2));
 
 
 UPDATE fusionax_activites SET Raison_sociale = TRIM(Raison_sociale), Libelle_fonctio = TRIM(Libelle_fonctio);
index e450574..6e2b2fe 100644 (file)
@@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS fusionax_adresses (
   pays VARCHAR(50) NOT NULL,
   tel VARCHAR(30) NOT NULL,
   fax VARCHAR(30) NOT NULL,
+  Date_maj DATE NOT NULL COMMENT 'Date de mise à jour de ces informations',
   Code_etab BIGINT(10) DEFAULT NULL,
   pid INT(11) UNSIGNED DEFAULT NULL,
   jobid INT(6) UNSIGNED DEFAULT NULL,
@@ -28,21 +29,24 @@ CREATE TABLE IF NOT EXISTS fusionax_adresses (
 LOAD DATA LOCAL INFILE '{?}Adresses.txt' INTO TABLE `fusionax_adresses` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (provenance, ax_id, @Type_adr, Ligne1, Ligne2, Ligne3, code_postal, ville, zip_cedex, etat_distr, pays, tel, fax, @StringDate_maj)
 SET
-`Type_adr` = IF(@Type_adr = 'E', 'E', IF(@Type_adr = '', '', 'P'));
+`Type_adr` = IF(@Type_adr = 'E', 'E', IF(@Type_adr = '', '', 'P')),
+`Date_maj` = CONCAT(SUBSTRING(@StringDate_maj,7),'-',SUBSTRING(@StringDate_maj,4,2),'-',SUBSTRING(@StringDate_maj,1,2));
 
 LOAD DATA LOCAL INFILE '{?}Anciens.txt' INTO TABLE `fusionax_adresses` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (provenance, ax_id, @login, @password, @promotion_etude, @gpe_promo, @Nom_patronymique, @partic_patro, @prenom, @Nom_usuel, @partic_nom,
   @Nom_complet, @civilite, @Code_nationalite, @type, @corps_sortie, @StringDate_deces, @grade, @Mel_usage, @Mel_publiable, @xxx, @xxx,
   @tel_mobile, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @X_M_D, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @Type_adr,
-  Ligne1, Ligne2, Ligne3, code_postal, ville, zip_cedex, etat_distr, pays, tel, fax, @date_MAJ)
+  Ligne1, Ligne2, Ligne3, code_postal, ville, zip_cedex, etat_distr, pays, tel, fax, @StringDate_maj)
 SET
-Type_adr = IF(@Type_adr = 'E', 'E', IF(@Type_adr = '', '', 'P'));
+Type_adr = IF(@Type_adr = 'E', 'E', IF(@Type_adr = '', '', 'P')),
+`Date_maj` = CONCAT(SUBSTRING(@StringDate_maj,7),'-',SUBSTRING(@StringDate_maj,4,2),'-',SUBSTRING(@StringDate_maj,1,2));
 
 LOAD DATA LOCAL INFILE '{?}Activites.txt' INTO TABLE `fusionax_adresses` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
 (provenance, ax_id, Code_etab, @Raison_sociale, @Libelle_fonctio, @Annuaire,
 Ligne1, Ligne2, Ligne3, code_postal, ville, zip_cedex, etat_distr, pays, tel, fax, @StringDate_maj)
 SET
-`Type_adr` = 'E';
+`Type_adr` = 'E',
+`Date_maj` = CONCAT(SUBSTRING(@StringDate_maj,7),'-',SUBSTRING(@StringDate_maj,4,2),'-',SUBSTRING(@StringDate_maj,1,2));
 
 UPDATE fusionax_adresses SET Ligne1 = TRIM(Ligne1), Ligne2 = TRIM(Ligne2), Ligne3 = TRIM(Ligne3), pays = TRIM(pays),
                              code_postal = TRIM(code_postal), ville = TRIM(ville), zip_cedex = TRIM(zip_cedex),
index c6d84d6..5e50eab 100644 (file)
@@ -20,6 +20,7 @@ CREATE TABLE IF NOT EXISTS fusionax_anciens (
   Mel_publiable TINYINT(4) NOT NULL COMMENT 'Autorisation d''utiliser le mail',
   Mob_publiable TINYINT(4) NOT NULL COMMENT 'Autorisation d''utiliser le mobile',
   tel_mobile VARCHAR(30) NOT NULL COMMENT 'Numéro de téléphone mobile',
+  Date_maj DATE NOT NULL COMMENT 'Date de mise à jour de ces informations',
   pid INT(11) UNSIGNED DEFAULT NULL,
   PRIMARY KEY  (ax_id),
   INDEX (pid)
@@ -29,9 +30,10 @@ LOAD DATA LOCAL INFILE '{?}Anciens.txt' INTO TABLE `fusionax_anciens` CHARACTER
 (AN, ax_id, @login, @password, promotion_etude, @gpe_promo, Nom_patronymique, partic_patro, prenom, Nom_usuel, partic_nom,
   Nom_complet, @civilite, Code_nationalite, @type, corps_sortie, @StringDate_deces, grade, Mel_usage, Mel_publiable, @xxx, Mob_publiable,
   tel_mobile, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @X_M_D, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @Type_adr,
-  @Ligne1, @Ligne2, @Ligne3, @code_postal, @ville, @zip_cedex, @etat_distr, @pays, @tel, @fax, @date_MAJ)
+  @Ligne1, @Ligne2, @Ligne3, @code_postal, @ville, @zip_cedex, @etat_distr, @pays, @tel, @fax, @StringDate_maj)
 SET
-    Date_deces = CONCAT(SUBSTRING(@StringDate_deces,7),'-',SUBSTRING(@StringDate_deces,4,2),'-',SUBSTRING(@StringDate_deces,1,2));
+    Date_deces = CONCAT(SUBSTRING(@StringDate_deces,7),'-',SUBSTRING(@StringDate_deces,4,2),'-',SUBSTRING(@StringDate_deces,1,2)),
+    Date_maj = CONCAT(SUBSTRING(@StringDate_maj,7),'-',SUBSTRING(@StringDate_maj,4,2),'-',SUBSTRING(@StringDate_maj,1,2));
 -- Mel_publiable is not certain yet :/
 
 ALTER TABLE fusionax_anciens ADD INDEX (ax_id);
index a966bfb..6d02a59 100644 (file)
@@ -3,6 +3,7 @@
 DROP TABLE IF EXISTS `fusionax_formations`;
 
 CREATE TABLE IF NOT EXISTS `fusionax_formations` (
+  Date_maj DATE NOT NULL COMMENT 'Date de mise à jour de ces informations',
   FO CHAR(2) NOT NULL COMMENT 'Vaut toujours FO pour cette table',
   ax_id VARCHAR(8) NOT NULL COMMENT 'Id unique de l''ancien',
   Intitule_formation VARCHAR(255) NOT NULL DEFAULT 0 COMMENT 'Intitulé de la formation',
@@ -23,7 +24,10 @@ CREATE TABLE IF NOT EXISTS `fusionax_formations` (
 ) ENGINE=InnoDB, CHARSET=utf8;
 
 LOAD DATA LOCAL INFILE  '{?}Formations.txt' INTO TABLE  fusionax_formations CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'
-(FO, ax_id, Intitule_formation, Intitule_diplome, Descr_formation);
+(@StringDate_maj, FO, ax_id, Intitule_formation, Intitule_diplome, Descr_formation)
+SET
+Date_maj = CONCAT(SUBSTRING(@StringDate_maj,7),'-',SUBSTRING(@StringDate_maj,4,2),'-',SUBSTRING(@StringDate_maj,1,2));
+
 
     UPDATE  fusionax_formations    AS f
 INNER JOIN  profile_education_enum AS e ON (f.Intitule_formation = e.abbreviation)
index 19f435a..69a8923 100755 (executable)
@@ -12,7 +12,7 @@ while (<FILE>)
 {
   # Dates removal.
   s/\r$//;
-  s/(\t)*[0-9]+\t[0-9]+\t([0-9]{2}\/){2}[0-9]+$//;
+  s/^(FO\t\w{8}\t[^\t]*)\t[0-9]+\t[0-9]+\t([0-9]{2}\/[0-9]{2}\/[0-9]+)$/\2\t\1/;
   # Trailing tab, spaces and dot removal.
   s/(\t| )*$//;
   s/( \t|\t )/\t/g;
@@ -20,50 +20,50 @@ while (<FILE>)
   s/ +/ /g;
 
   # Removes empty educations and jobs (they have nothing to do there).
-  s/^FO\t\w{8}$//;
-  s/^FO\t\w{8}\tProfdes Universités$//;
-  s/^FO\t\w{8}\tPréshonColonie Frdu Caire$//;
-  s/^FO\t\w{8}\tInspgénhonCEA$//;
-  s/^FO\t\w{8}\tProf Emérite Gén Méca$//;
-  s/^FO\t\w{8}\tAncDG Dassault Aviation$//;
-  s/^FO\t\w{8}\tPilote militaire Hélicoptère$//;
-  s/^FO\t\w{8}\tProfHonSupAéro$//;
-  s/^FO\t\w{8}\tPilote de chasse$//;
-  s/^FO\t\w{8}\tProf ENSMP$//;
-  s/^FO\t\w{8}\tProf hon Univ Bordeaux I$//;
-  s/^FO\t\w{8}\tProf$//;
-  s/^FO\t\w{8}\tIng Navigant d'Essais Hélicoptère$//;
-  s/^FO\t\w{8}\tMandataire agrée OEB$//;
-  s/^FO\t\w{8}\tIngSt$//;
-  s/^FO\t\w{8}\tIngretrAérospatiale$//;
-  s/^FO\t\w{8}\tIngénieur$//;
-  s/^FO\t\w{8}\tIng EURATOM$//;
-  s/^FO\t\w{8}\tInspGénCRdes Affd'OM$//;
-  s/^FO\t\w{8}\tAvocat au Barreau de Paris$//;
-  s/^FO\t\w{8}\tCambridge Profic$//;
-  s/^FO\t\w{8}\tPilotage militaire$//;
-  s/^FO\t\w{8}\tDirectHonBNP$//;
-  s/^FO\t\w{8}\tInspecteur des Finances$//;
-  s/^FO\t\w{8}\tMITI Japon$//;
-  s/^FO\t\w{8}\tEuropean Patent Attorney$//;
-  s/^FO\t\w{8}\tAdmciv$//;
-  s/^FO\t\w{8}\tDirecthon SNCF$//;
-  s/^FO\t\w{8}\tDDI Informatique$//;
-  s/^FO\t\w{8}\tDDI$//;
-  s/^FO\t\w{8}\tSFAF$//;
-  s/^FO\t\w{8}\tGestalt praticien$//;
-  s/^FO\t\w{8}\tAdmciv HC$//;
-  s/^FO\t\w{8}\tPsychologue Clinicien$//;
-  s/^FO\t\w{8}\tAnc Avocat au Bareau de Toulon$//;
-  s/^FO\t\w{8}\tAnalyste SFAF$//;
-  s/^FO\t\w{8}\tEcole de Chasse$//;
-  s/^FO\t\w{8}\tPost Doc$//;
-  s/^FO\t\w{8}\tSFAF CIIA$//;
-  s/^FO\t\w{8}\tINSEE$//;
-  s/^FO\t\w{8}\tEconomiste Statisticien$//;
+  s/^.*\tFO\t\w{8}$//;
+  s/^.*\tFO\t\w{8}\tProfdes Universités$//;
+  s/^.*\tFO\t\w{8}\tPréshonColonie Frdu Caire$//;
+  s/^.*\tFO\t\w{8}\tInspgénhonCEA$//;
+  s/^.*\tFO\t\w{8}\tProf Emérite Gén Méca$//;
+  s/^.*\tFO\t\w{8}\tAncDG Dassault Aviation$//;
+  s/^.*\tFO\t\w{8}\tPilote militaire Hélicoptère$//;
+  s/^.*\tFO\t\w{8}\tProfHonSupAéro$//;
+  s/^.*\tFO\t\w{8}\tPilote de chasse$//;
+  s/^.*\tFO\t\w{8}\tProf ENSMP$//;
+  s/^.*\tFO\t\w{8}\tProf hon Univ Bordeaux I$//;
+  s/^.*\tFO\t\w{8}\tProf$//;
+  s/^.*\tFO\t\w{8}\tIng Navigant d'Essais Hélicoptère$//;
+  s/^.*\tFO\t\w{8}\tMandataire agrée OEB$//;
+  s/^.*\tFO\t\w{8}\tIngSt$//;
+  s/^.*\tFO\t\w{8}\tIngretrAérospatiale$//;
+  s/^.*\tFO\t\w{8}\tIngénieur$//;
+  s/^.*\tFO\t\w{8}\tIng EURATOM$//;
+  s/^.*\tFO\t\w{8}\tInspGénCRdes Affd'OM$//;
+  s/^.*\tFO\t\w{8}\tAvocat au Barreau de Paris$//;
+  s/^.*\tFO\t\w{8}\tCambridge Profic$//;
+  s/^.*\tFO\t\w{8}\tPilotage militaire$//;
+  s/^.*\tFO\t\w{8}\tDirectHonBNP$//;
+  s/^.*\tFO\t\w{8}\tInspecteur des Finances$//;
+  s/^.*\tFO\t\w{8}\tMITI Japon$//;
+  s/^.*\tFO\t\w{8}\tEuropean Patent Attorney$//;
+  s/^.*\tFO\t\w{8}\tAdmciv$//;
+  s/^.*\tFO\t\w{8}\tDirecthon SNCF$//;
+  s/^.*\tFO\t\w{8}\tDDI Informatique$//;
+  s/^.*\tFO\t\w{8}\tDDI$//;
+  s/^.*\tFO\t\w{8}\tSFAF$//;
+  s/^.*\tFO\t\w{8}\tGestalt praticien$//;
+  s/^.*\tFO\t\w{8}\tAdmciv HC$//;
+  s/^.*\tFO\t\w{8}\tPsychologue Clinicien$//;
+  s/^.*\tFO\t\w{8}\tAnc Avocat au Bareau de Toulon$//;
+  s/^.*\tFO\t\w{8}\tAnalyste SFAF$//;
+  s/^.*\tFO\t\w{8}\tEcole de Chasse$//;
+  s/^.*\tFO\t\w{8}\tPost Doc$//;
+  s/^.*\tFO\t\w{8}\tSFAF CIIA$//;
+  s/^.*\tFO\t\w{8}\tINSEE$//;
+  s/^.*\tFO\t\w{8}\tEconomiste Statisticien$//;
   s/^\n//;
   # Places education in third place as if it is not reconized, it will only be stored as a description.
-  s/^(FO\t\w{8}\t)/\1\t\t/;
+  s/^(.*\tFO\t\w{8}\t)/\1\t\t/;
 
   # Fixes what can be fixed.
   # École d'Ingénieurs
@@ -1543,87 +1543,87 @@ while (<FILE>)
   s/\t\t\tInstForm SupBiomédicale$/\t\t\tBiomédical/;
 
   # Double diploma that need to be splitted.
-  s/^(FO\t\w{8}\t\t)\tDoct HDR Ecotoxicologie$/\1PhD\tÉcotoxicologie\n\1HDR\tÉcotoxicologie/;
-  s/^(FO\t\w{8}\t\t)\tAgrégé et Doct en Génie civil$/\1PhD\tGénie civil\n\1Agr.\tGénie civil/;
-  s/^(FO\t\w{8}\t\t)\tDoct Habilité à la dir de rech en Philosophie$/\1PhD\tPhilosophie\n\1HDR\tPhilosophie/;
-  s/^(FO\t\w{8}\t\t)\tDEA\+ Thèse Doctorat Pharmacochimie moléculaire$/\1PhD\tPharmacochimie moléculaire\n\1DEA\tPharmacochimie moléculaire/;
-  s/^(FO\t\w{8}\t\t)\tDoctorat\, HDR Informatique$/\1PhD\tInformatique\n\1HDR\tInformatique/;
-  s/^(FO\t\w{8}\t\t)\tDoctorat et Habilitation$/\1PhD\t\n\1HDR\t/;
-  s/^(FO\t\w{8}\t)\t\tPhD et Habil à diriger les RechUniv Paris 6$/\1UPMC\tPhD\t\n\1UPMC\tHDR\t/;
-  s/^(FO\t\w{8}\t)\t\tMS & PhD EHESS$/\1EHESS\tPhD\t\n\1EHESS\tMSc\t/;
-  s/^(FO\t\w{8}\t)\t\tMBAIEP Paris Lic de Droit Assas$/\1Sciences Po\tDipl.\t\n\1Assas\tLic.\tDroit/;
-  s/^(FO\t\w{8}\t)\t\tIEP Paris Lic de Droit Assas$/\1Sciences Po\tDipl.\t\n\1Assas\tLic.\tDroit/;
-  s/^(FO\t\w{8}\t)\t\tIngENST licencié sciences économiques$/\1Télécom\tIng.\t\n\1\tLic.\tÉconomie/;
-  s/^(FO\t\w{8}\t\t)\tMastère Aménagement et Maitrise d'Ouvrage Urbaine$/\1M\tAménagement\n\1Maîtr.\tOuvrage Urbain/;
-  s/^(FO\t\w{8}\t\t)\tDEA et Thèse de Biologie$/\1PhD\tBiologie\n\1DEA\tBiologie/;
-  s/^(FO\t\w{8}\t)\t\tDEA Thèse Jussieu$/\1UPMC\tPhD\t\n\1UPMC\tDEA\t/;
-  s/^(FO\t\w{8}\t\t)\tDESS CAAE MBA$/\1DESS\t\n\1MBA\t/;
-  s/^(FO\t\w{8}\t)\t\tIngSupelec 86 - EMBA HEC 04$/\1Supélec\tIng.\t\n\1HEC\tMBA\t/;
-  s/^(FO\t\w{8}\t)\t\tMBA MscMassachus$/\1MIT\tMBA\t\n\1MIT\tMSc\t/;
-  s/^(FO\t\w{8}\t)\t\tMBA Columbia \+ LBS/\1Columbia University\tMBA\t\n\1London Business School\tM\t/;
-  s/^(FO\t\w{8}\t)\t\tMS Columbia & sciences Po/\1Columbia University\tMSc\t\n\1Sciences Po\tDipl.\t/;
+  s/^(.*\tFO\t\w{8}\t\t)\tDoct HDR Ecotoxicologie$/\1PhD\tÉcotoxicologie\n\1HDR\tÉcotoxicologie/;
+  s/^(.*\tFO\t\w{8}\t\t)\tAgrégé et Doct en Génie civil$/\1PhD\tGénie civil\n\1Agr.\tGénie civil/;
+  s/^(.*\tFO\t\w{8}\t\t)\tDoct Habilité à la dir de rech en Philosophie$/\1PhD\tPhilosophie\n\1HDR\tPhilosophie/;
+  s/^(.*\tFO\t\w{8}\t\t)\tDEA\+ Thèse Doctorat Pharmacochimie moléculaire$/\1PhD\tPharmacochimie moléculaire\n\1DEA\tPharmacochimie moléculaire/;
+  s/^(.*\tFO\t\w{8}\t\t)\tDoctorat\, HDR Informatique$/\1PhD\tInformatique\n\1HDR\tInformatique/;
+  s/^(.*\tFO\t\w{8}\t\t)\tDoctorat et Habilitation$/\1PhD\t\n\1HDR\t/;
+  s/^(.*\tFO\t\w{8}\t)\t\tPhD et Habil à diriger les RechUniv Paris 6$/\1UPMC\tPhD\t\n\1UPMC\tHDR\t/;
+  s/^(.*\tFO\t\w{8}\t)\t\tMS & PhD EHESS$/\1EHESS\tPhD\t\n\1EHESS\tMSc\t/;
+  s/^(.*\tFO\t\w{8}\t)\t\tMBAIEP Paris Lic de Droit Assas$/\1Sciences Po\tDipl.\t\n\1Assas\tLic.\tDroit/;
+  s/^(.*\tFO\t\w{8}\t)\t\tIEP Paris Lic de Droit Assas$/\1Sciences Po\tDipl.\t\n\1Assas\tLic.\tDroit/;
+  s/^(.*\tFO\t\w{8}\t)\t\tIngENST licencié sciences économiques$/\1Télécom\tIng.\t\n\1\tLic.\tÉconomie/;
+  s/^(.*\tFO\t\w{8}\t\t)\tMastère Aménagement et Maitrise d'Ouvrage Urbaine$/\1M\tAménagement\n\1Maîtr.\tOuvrage Urbain/;
+  s/^(.*\tFO\t\w{8}\t\t)\tDEA et Thèse de Biologie$/\1PhD\tBiologie\n\1DEA\tBiologie/;
+  s/^(.*\tFO\t\w{8}\t)\t\tDEA Thèse Jussieu$/\1UPMC\tPhD\t\n\1UPMC\tDEA\t/;
+  s/^(.*\tFO\t\w{8}\t\t)\tDESS CAAE MBA$/\1DESS\t\n\1MBA\t/;
+  s/^(.*\tFO\t\w{8}\t)\t\tIngSupelec 86 - EMBA HEC 04$/\1Supélec\tIng.\t\n\1HEC\tMBA\t/;
+  s/^(.*\tFO\t\w{8}\t)\t\tMBA MscMassachus$/\1MIT\tMBA\t\n\1MIT\tMSc\t/;
+  s/^(.*\tFO\t\w{8}\t)\t\tMBA Columbia \+ LBS/\1Columbia University\tMBA\t\n\1London Business School\tM\t/;
+  s/^(.*\tFO\t\w{8}\t)\t\tMS Columbia & sciences Po/\1Columbia University\tMSc\t\n\1Sciences Po\tDipl.\t/;
 
   #############################################################################
   # Devel formatting.
   # # Both university and diploma missing.
-  #s/^FO\t\w{8}\t\t\tExpertise comptable$//;
-  #s/^FO\t\w{8}\t\t\tLangues orientales \(Chinois\)$//;
-  #s/^FO\t\w{8}\t\t\tÉducateur spécialisé$//;
-  #s/^FO\t\w{8}\t\t\tGestion$//;
-  #s/^FO\t\w{8}\t\t\tBiomédical$//;
-  #s/^FO\t\w{8}\t\t\tBrth$//;
-  #s/^FO\t\w{8}\t\t\tDEM$//;
-  #s/^FO\t\w{8}\t\t\tDT$//;
-  #s/^FO\t\w{8}\t\t\tBESG$//;
-  #s/^FO\t\w{8}\t\t\tESO$//;
-  #s/^FO\t\w{8}\t\t\tBT$//;
-  #s/^FO\t\w{8}\t\t\tBEL$//;
-  #s/^FO\t\w{8}\t\t\tDipl Lt Et Sup Banq$//;
-  #s/^FO\t\w{8}\t\t\tDiplôme Nepali-Tibétain$//;
-  #s/^FO\t\w{8}\t\t\tReact School Harwell$//;
-  #s/^FO\t\w{8}\t\t\tEATG$//;
-  #s/^FO\t\w{8}\t\t\tDESA$//;
-  #s/^FO\t\w{8}\t\t\tDIUUP$//;
-  #s/^FO\t\w{8}\t\t\tDrrerNat$//;
-  #s/^FO\t\w{8}\t\t\tIAC$//;
-  #s/^FO\t\w{8}\t\t\tCESDR$//;
-  #s/^FO\t\w{8}\t\t\tAuditeur ScPolitique$//;
-  #s/^FO\t\w{8}\t\t\tCES Informatique$//;
-  #s/^FO\t\w{8}\t\t\tDon en religion$//;
-  #s/^FO\t\w{8}\t\t\tDSN$//;
-  #s/^FO\t\w{8}\t\t\tBEMS\/CHEM$//;
-  #s/^FO\t\w{8}\t\t\tCESSID$//;
-  #s/^FO\t\w{8}\t\t\tBiologie Moléculaire$//;
-  #s/^FO\t\w{8}\t\t\tMécanique des Transfert$//;
-  #s/^FO\t\w{8}\t\t\tGestion$//;
-  #s/^FO\t\w{8}\t\t\tDECS$//;
-  #s/^FO\t\w{8}\t\t\tCFAF$//;
-  #s/^FO\t\w{8}\t\t\tCRC$//;
-  #s/^FO\t\w{8}\t\t\tMASE$//;
-  #s/^FO\t\w{8}\t\t\tCollège des Sciences Soc et Eco$//;
-  #s/^FO\t\w{8}\t\t\tInstitut de Contrôle de Gestion$//;
-  #s/^FO\t\w{8}\t\t\tICG$//;
-  #s/^FO\t\w{8}\t\t\tETS II$//;
-  #s/^FO\t\w{8}\t\t\tFRM$//;
-  #s/^FO\t\w{8}\t\t\tArchitecte DPLG$//;
-  #s/^FO\t\w{8}\t\t\tCycle des Hautes Etudes CHEE$//;
-  #s/^FO\t\w{8}\t\t\tCHEE&DD Session 9$//;
-  #s/^FO\t\w{8}\t\t\tCSME Session 29$//;
-  #s/^FO\t\w{8}\t\t\tInternat Teachers Progr$//;
-  #s/^FO\t\w{8}\t\t\tCSCP$//;
-  #s/^FO\t\w{8}\t\t\tBaccalauréat canonique$//;
-  #s/^FO\t\w{8}\t\t\tCertif européen de Psychothérapie$//;
-  #s/^FO\t\w{8}\t\t\tIFG$//;
-  #s/^FO\t\w{8}\t\t\tIFP$//;
-  #s/^FO\t\w{8}\t\t\tArchitecte dplg$//;
-  #s/^FO\t\w{8}\t\t\tLLCE Chinois INALCO$//;
-  #s/^FO\t\w{8}\t\t\tInst du Contrôle de Gestion$//;
-  #s/^FO\t\w{8}\t\t\tInstitut Auguste Comte$//;
-  #s/^FO\t\w{8}\t\t\tInst Auguste Comte$//;
-  #s/^FO\t\w{8}\t\t\tUSMC Command & Staff College$//;
-  #s/^FO\t\w{8}\t\t\tISNSE Argunne National Laboratory USA$//;
+  #s/^.*\tFO\t\w{8}\t\t\tExpertise comptable$//;
+  #s/^.*\tFO\t\w{8}\t\t\tLangues orientales \(Chinois\)$//;
+  #s/^.*\tFO\t\w{8}\t\t\tÉducateur spécialisé$//;
+  #s/^.*\tFO\t\w{8}\t\t\tGestion$//;
+  #s/^.*\tFO\t\w{8}\t\t\tBiomédical$//;
+  #s/^.*\tFO\t\w{8}\t\t\tBrth$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDEM$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDT$//;
+  #s/^.*\tFO\t\w{8}\t\t\tBESG$//;
+  #s/^.*\tFO\t\w{8}\t\t\tESO$//;
+  #s/^.*\tFO\t\w{8}\t\t\tBT$//;
+  #s/^.*\tFO\t\w{8}\t\t\tBEL$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDipl Lt Et Sup Banq$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDiplôme Nepali-Tibétain$//;
+  #s/^.*\tFO\t\w{8}\t\t\tReact School Harwell$//;
+  #s/^.*\tFO\t\w{8}\t\t\tEATG$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDESA$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDIUUP$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDrrerNat$//;
+  #s/^.*\tFO\t\w{8}\t\t\tIAC$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCESDR$//;
+  #s/^.*\tFO\t\w{8}\t\t\tAuditeur ScPolitique$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCES Informatique$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDon en religion$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDSN$//;
+  #s/^.*\tFO\t\w{8}\t\t\tBEMS\/CHEM$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCESSID$//;
+  #s/^.*\tFO\t\w{8}\t\t\tBiologie Moléculaire$//;
+  #s/^.*\tFO\t\w{8}\t\t\tMécanique des Transfert$//;
+  #s/^.*\tFO\t\w{8}\t\t\tGestion$//;
+  #s/^.*\tFO\t\w{8}\t\t\tDECS$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCFAF$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCRC$//;
+  #s/^.*\tFO\t\w{8}\t\t\tMASE$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCollège des Sciences Soc et Eco$//;
+  #s/^.*\tFO\t\w{8}\t\t\tInstitut de Contrôle de Gestion$//;
+  #s/^.*\tFO\t\w{8}\t\t\tICG$//;
+  #s/^.*\tFO\t\w{8}\t\t\tETS II$//;
+  #s/^.*\tFO\t\w{8}\t\t\tFRM$//;
+  #s/^.*\tFO\t\w{8}\t\t\tArchitecte DPLG$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCycle des Hautes Etudes CHEE$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCHEE&DD Session 9$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCSME Session 29$//;
+  #s/^.*\tFO\t\w{8}\t\t\tInternat Teachers Progr$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCSCP$//;
+  #s/^.*\tFO\t\w{8}\t\t\tBaccalauréat canonique$//;
+  #s/^.*\tFO\t\w{8}\t\t\tCertif européen de Psychothérapie$//;
+  #s/^.*\tFO\t\w{8}\t\t\tIFG$//;
+  #s/^.*\tFO\t\w{8}\t\t\tIFP$//;
+  #s/^.*\tFO\t\w{8}\t\t\tArchitecte dplg$//;
+  #s/^.*\tFO\t\w{8}\t\t\tLLCE Chinois INALCO$//;
+  #s/^.*\tFO\t\w{8}\t\t\tInst du Contrôle de Gestion$//;
+  #s/^.*\tFO\t\w{8}\t\t\tInstitut Auguste Comte$//;
+  #s/^.*\tFO\t\w{8}\t\t\tInst Auguste Comte$//;
+  #s/^.*\tFO\t\w{8}\t\t\tUSMC Command & Staff College$//;
+  #s/^.*\tFO\t\w{8}\t\t\tISNSE Argunne National Laboratory USA$//;
   ## # Formatted stuff.
-  #s/^FO\t\w{8}((\t|\t\t)[a-zA-Z1-9'\.éèêùüàäïîşńÉÈÊÙÀÜÄÏÎŞŃ \-\(\)]+)\t.*//;
+  #s/^.*\tFO\t\w{8}((\t|\t\t)[a-zA-Z1-9'\.éèêùüàäïîşńÉÈÊÙÀÜÄÏÎŞŃ \-\(\)]+)\t.*//;
   # # Removes empty lines.
   s/^\n//;
 
index 109f8b9..5f04266 100755 (executable)
@@ -19,6 +19,14 @@ foreach (array('fusionax_activites', 'fusionax_adresses', 'fusionax_anciens', 'f
     XDB::rawExecute("DELETE FROM $table WHERE pid IS NULL");
 }
 
+echo "Update timestamp.\n";
+XDB::rawExecute("UPDATE  profiles AS p
+                    SET  p.last_change = GREATEST(COALESCE((SELECT MAX(Date_maj) FROM fusionax_anciens    AS f WHERE f.pid = p.pid), '0000-00-00'),
+                                                  COALESCE((SELECT MAX(Date_maj) FROM fusionax_activites  AS f WHERE f.pid = p.pid), '0000-00-00'),
+                                                  COALESCE((SELECT MAX(Date_maj) FROM fusionax_adresses   AS f WHERE f.pid = p.pid), '0000-00-00'),
+                                                  COALESCE((SELECT MAX(Date_maj) FROM fusionax_formations AS f WHERE f.pid = p.pid), '0000-00-00'),
+                                                  COALESCE(p.last_change, '0000-00-00'))");
+
 // Includes entreprises we do not have into profile_job_enum.
 // We first retrieve AX code, then add missing compagnies.
 echo "Starts jobs inclusions.\n";
@@ -138,6 +146,10 @@ XDB::rawExecute('UPDATE  profiles         AS p
 XDB::rawExecute('ALTER TABLE geoloc_countries DROP INDEX licensePlate');
 
 // Updates corps.
+XDB::rawExecute('UPDATE  profile_corps      AS pc
+             INNER JOIN  fusionax_anciens   AS f ON (f.pid = pc.pid)
+             INNER JOIN  profile_corps_enum AS c ON (f.corps_sortie = c.abbreviation)
+                    SET  pc.original_corpsid = c.id');
 XDB::rawExecute("INSERT IGNORE INTO  profile_corps (pid, original_corpsid, current_corpsid, rankid, corps_pub)
                              SELECT  f.pid, c.id, c.id, r.id, 'ax'
                                FROM  fusionax_anciens        AS f