Merge: improves promotion comparison, adds name comparison.
authorStéphane Jacob <sj@m4x.org>
Mon, 11 Oct 2010 20:30:06 +0000 (22:30 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 11 Oct 2010 20:34:51 +0000 (22:34 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/fusionax.php
templates/fusionax/index.tpl
templates/fusionax/names.tpl [new file with mode: 0644]
templates/fusionax/promo.tpl

index e5d853d..c391ad1 100644 (file)
@@ -40,6 +40,7 @@ class FusionAxModule extends PLModule
             'fusionax/ids'      => $this->make_hook('ids',      AUTH_MDP, 'admin'),
             'fusionax/deceased' => $this->make_hook('deceased', AUTH_MDP, 'admin'),
             'fusionax/promo'    => $this->make_hook('promo',    AUTH_MDP, 'admin'),
+            'fusionax/names'    => $this->make_hook('names',    AUTH_MDP, 'admin'),
         );
     }
 
@@ -462,18 +463,85 @@ class FusionAxModule extends PLModule
         $page->changeTpl('fusionax/promo.tpl');
         $res = XDB::iterator('SELECT  pid, private_name, promo_etude_xorg, promo_sortie_xorg, promo_etude_ax, promo
                                 FROM  fusionax_promo
-                               WHERE  !(promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 3 = promo_sortie_xorg)');
+                               WHERE  !(promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 3 = promo_sortie_xorg)
+                                      AND !(promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 4 = promo_sortie_xorg)
+                                      AND !(promo_etude_ax = promo_etude_xorg + 1)
+                            ORDER BY  promo_etude_xorg');
         $nbMissmatchingPromos = $res->total();
+        $page->assign('nbMissmatchingPromos', $res->total());
+        $page->assign('missmatchingPromos', $res);
+
+        $res = XDB::iterator('SELECT  pid, private_name, promo_etude_xorg, promo_sortie_xorg, promo_etude_ax, promo
+                                FROM  fusionax_promo
+                               WHERE  promo_etude_ax = promo_etude_xorg + 1
+                            ORDER BY  promo_etude_xorg');
+        $nbMissmatchingPromos += $res->total();
         $page->assign('nbMissmatchingPromos1', $res->total());
         $page->assign('missmatchingPromos1', $res);
+
         $res = XDB::iterator('SELECT  pid, private_name, promo_etude_xorg, promo_sortie_xorg, promo_etude_ax, promo
                                 FROM  fusionax_promo
-                               WHERE  promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 3 = promo_sortie_xorg');
+                               WHERE  promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 3 = promo_sortie_xorg
+                            ORDER BY  promo_etude_xorg');
         $nbMissmatchingPromos += $res->total();
         $page->assign('nbMissmatchingPromos2', $res->total());
         $page->assign('missmatchingPromos2', $res);
-        $page->assign('nbMissmatchingPromos', $nbMissmatchingPromos);
+
+        $res = XDB::iterator('SELECT  pid, private_name, promo_etude_xorg, promo_sortie_xorg, promo_etude_ax, promo
+                                FROM  fusionax_promo
+                               WHERE  promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 4 = promo_sortie_xorg
+                            ORDER BY  promo_etude_xorg');
+        $nbMissmatchingPromos += $res->total();
+        $page->assign('nbMissmatchingPromos3', $res->total());
+        $page->assign('missmatchingPromos3', $res);
+
+        $page->assign('nbMissmatchingPromosTotal', $nbMissmatchingPromos);
+    }
+
+    function handler_names(&$page, $action = '')
+    {
+        $page->changeTpl('fusionax/names.tpl');
+
+        $res = XDB::query('SELECT  COUNT(*)
+                             FROM  fusionax_anciens AS f
+                       INNER JOIN  profiles         AS p    ON (f.ax_id = p.ax_id)');
+        $page->assign('total', $res->fetchOneCell());
+
+        // To be checked:
+        // | lastname           |  1 |
+        // | lastname_marital   |  2 |
+        // | lastname_ordinary  |  3 |
+        // | firstname          |  4 |
+        // | firstname_ordinary |  7 |
+        // | firstname_other    |  8 |
+        // | name_other         |  9 |
+        // | name_ini           | 10 |
+        // | firstname_ini      | 11 |
+        $res = XDB::query("SELECT  COUNT(*)
+                             FROM  fusionax_anciens AS f
+                       INNER JOIN  profiles         AS p   ON (f.ax_id = p.ax_id)
+                        LEFT JOIN  profile_name     AS pnp ON (p.pid = pnp.pid AND pnp.typeid = 1)
+                        LEFT JOIN  profile_name     AS pnm ON (p.pid = pnm.pid AND pnm.typeid = 2)
+                        LEFT JOIN  profile_name     AS pno ON (p.pid = pno.pid AND pno.typeid = 3)
+                        LEFT JOIN  profile_name     AS pne ON (p.pid = pne.pid AND pne.typeid = 9)
+                        LEFT JOIN  profile_name     AS pni ON (p.pid = pni.pid AND pni.typeid = 10)
+                            WHERE  IF(f.partic_patro, CONCAT(f.partic_patro, CONCAT(' ', f.Nom_patronymique)), f.Nom_patronymique) NOT IN (pnp.name, pno.name, pnm.name, pne.name, pni.name)
+                                   OR IF(f.partic_nom, CONCAT(f.partic_nom, CONCAT(' ', f.Nom_usuel)), f.Nom_usuel) NOT IN (pnp.name, pno.name, pnm.name, pne.name, pni.name)
+                                   OR f.Nom_complet NOT IN (pnp.name, pno.name, pnm.name, pne.name, pni.name)");
+        $page->assign('lastnameIssues', $res->fetchOneCell());
+
+        $res = XDB::query('SELECT  COUNT(*)
+                             FROM  fusionax_anciens AS f
+                       INNER JOIN  profiles         AS p   ON (f.ax_id = p.ax_id)
+                        LEFT JOIN  profile_name     AS pnf ON (p.pid = pnf.pid AND pnf.typeid = 4)
+                        LEFT JOIN  profile_name     AS pno ON (p.pid = pno.pid AND pno.typeid = 7)
+                        LEFT JOIN  profile_name     AS pne ON (p.pid = pne.pid AND pne.typeid = 8)
+                        LEFT JOIN  profile_name     AS pni ON (p.pid = pni.pid AND pni.typeid = 11)
+                            WHERE  f.prenom NOT IN (pnf.name, pno.name, pne.name, pni.name)');
+        $page->assign('firstnameIssues', $res->fetchOneCell());
+
     }
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:?>
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
index 351842c..7c2ddfa 100644 (file)
   <li>Création des <a href="fusionax/view">VIEW annexes nécessaires aux corrélations</a></li>
   <li>Corrélation des <a href="fusionax/deceased">dates de décès</a></li>
   <li>Corrélation des <a href="fusionax/promo">promotions</a></li>
-  <li>Corrélation des <a href="fusionax/names">données d'identification</a></li>
-  <li>Corrélation des <a href="fusionax/coords">coordonnées</a></li>
-  <li>Corrélation des <a href="fusionax/pros">informations professionnelles</a></li>
-  <li>Corrélation des <a href="fusionax/studies">informations de formations</a></li>
+  <li>Corrélation des <a href="fusionax/names">noms</a></li>
 </ul>
 
+<p>
+  Une fois ces vérifications faites, un root peut lancer le script merge.php dans le répertoire upgrade/1.0.1/merge/
+</p>
+
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/fusionax/names.tpl b/templates/fusionax/names.tpl
new file mode 100644 (file)
index 0000000..d9d1f4c
--- /dev/null
@@ -0,0 +1,35 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2010 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.org/                                  *}
+{*                                                                        *}
+{*  This program is free software; you can redistribute it and/or modify  *}
+{*  it under the terms of the GNU General Public License as published by  *}
+{*  the Free Software Foundation; either version 2 of the License, or     *}
+{*  (at your option) any later version.                                   *}
+{*                                                                        *}
+{*  This program is distributed in the hope that it will be useful,       *}
+{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
+{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
+{*  GNU General Public License for more details.                          *}
+{*                                                                        *}
+{*  You should have received a copy of the GNU General Public License     *}
+{*  along with this program; if not, write to the Free Software           *}
+{*  Foundation, Inc.,                                                     *}
+{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<h2><a href="fusionax">Fusion des annuaires X.org - AX</a> / noms</h2>
+
+<p></p>
+
+<p>
+  Il y a {$total} camarades dans l'intersection de nos bases.
+  <ul>
+    <li>{$lastnameIssues} des noms de l'AX ne sont pas dans les notres.</li>
+    <li>{$firstnameIssues} des prénoms de l'AX ne sont pas dans les notres.</li>
+  </ul>
+</p>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 7d67c0f..c9d8fa8 100644 (file)
 
 <p></p>
 
-{if $nbMissmatchingPromos > 0}
-<p>Il y a {$nbMissmatchingPromos} différences entre les deux bases dans pour les promotions.</p>
-<p>Grosses différences (oranjisation ?) :</p>
+{if $nbMissmatchingPromosTotal > 0}
+<p>Il y a {$nbMissmatchingPromosTotal} différences entre les deux bases dans pour les promotions.</p>
+
+<p>Grosses différences ({$nbMissmatchingPromos} camarades) :</p>
+{include file='fusionax/listFusion.tpl' fusionList=$missmatchingPromos field1='pid' namefield1='ID X.org' field3='promo_etude_xorg'
+namefield3='etude_xorg' field4='promo_sortie_xorg' namefield4='sortie_xorg' field2='promo_etude_ax' namefield2='etude_ax'}
+
+<p>Petites différences (oranjisation) ({$nbMissmatchingPromos1} camarades) :</p>
 {include file='fusionax/listFusion.tpl' fusionList=$missmatchingPromos1 field1='pid' namefield1='ID X.org' field3='promo_etude_xorg'
 namefield3='etude_xorg' field4='promo_sortie_xorg' namefield4='sortie_xorg' field2='promo_etude_ax' namefield2='etude_ax'}
 
-<p>Petites différences : promo_etude_xorg == promo_etude_ax + 1 et promo_etude_xorg + 3 == promo_sortie_xorg, a priori ce sont les étrangers que nous avons mal
-inclus</p>
+<p>Petites différences (oranjisation + étrangers) ({$nbMissmatchingPromos3} camarades) :</p>
+{include file='fusionax/listFusion.tpl' fusionList=$missmatchingPromos3 field1='pid' namefield1='ID X.org' field3='promo_etude_xorg'
+namefield3='etude_xorg' field4='promo_sortie_xorg' namefield4='sortie_xorg' field2='promo_etude_ax' namefield2='etude_ax'}
+
+<p>Petites différences : (étrangers mal inclus) ({$nbMissmatchingPromos2} camarades)</p>
 {include file='fusionax/listFusion.tpl' fusionList=$missmatchingPromos2 field1='pid' namefield1='ID X.org' field3='promo_etude_xorg'
 namefield3='etude_xorg' field4='promo_sortie_xorg' namefield4='sortie_xorg' field2='promo_etude_ax' namefield2='etude_ax'}
 {/if}