Adds education verifications before merge.
authorStéphane Jacob <sj@m4x.org>
Mon, 1 Nov 2010 20:39:18 +0000 (21:39 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 1 Nov 2010 21:19:40 +0000 (22:19 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/fusionax.php
templates/fusionax/education.tpl [new file with mode: 0644]
templates/fusionax/index.tpl

index ff77c3b..857f0d2 100644 (file)
@@ -41,7 +41,8 @@ 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')
+                'fusionax/names'            => $this->make_hook('names',    AUTH_MDP, 'admin'),
+                'fusionax/edu'              => $this->make_hook('edu',      AUTH_MDP, 'admin')
             );
         } elseif (Platal::globals()->merge->state == 'done') {
             return array(
@@ -575,6 +576,37 @@ class FusionAxModule extends PLModule
 
     }
 
+    function handler_edu(&$page, $action = '')
+    {
+        $page->changeTpl('fusionax/education.tpl');
+
+        $missingEducation = XDB::rawIterator("SELECT  DISTINCT(f.Intitule_diplome)
+                                                FROM  fusionax_formations AS f
+                                               WHERE  f.Intitule_diplome != '' AND NOT EXISTS (SELECT  *
+                                                                                                 FROM  profile_education_enum AS e
+                                                                                                WHERE  f.Intitule_diplome = e.name)");
+        $missingDegree = XDB::rawIterator("SELECT  DISTINCT(f.Intitule_formation)
+                                             FROM  fusionax_formations AS f
+                                            WHERE  f.Intitule_formation != '' AND NOT EXISTS (SELECT  *
+                                                                                                FROM  profile_education_degree_enum AS e
+                                                                                               WHERE  f.Intitule_formation = e.abbreviation)");
+        $missingCouple = XDB::rawIterator("SELECT  DISTINCT(f.Intitule_diplome) AS edu, f.Intitule_formation AS degree, ee.id AS eduid, de.id AS degreeid
+                                             FROM  fusionax_formations           AS f
+                                       INNER JOIN  profile_education_enum        AS ee ON (f.Intitule_diplome = ee.name)
+                                       INNER JOIN  profile_education_degree_enum AS de ON (f.Intitule_formation = de.abbreviation)
+                                            WHERE  f.Intitule_diplome != '' AND f.Intitule_formation != ''
+                                                   AND NOT EXISTS (SELECT  *
+                                                                     FROM  profile_education_degree AS d
+                                                                    WHERE  ee.id = d.eduid AND de.id = d.degreeid)");
+
+        $page->assign('missingEducation', $missingEducation);
+        $page->assign('missingDegree', $missingDegree);
+        $page->assign('missingCouple', $missingCouple);
+        $page->assign('missingEducationCount', $missingEducation->total());
+        $page->assign('missingDegreeCount', $missingDegree->total());
+        $page->assign('missingCoupleCount', $missingCouple->total());
+    }
+
     function handler_issues_deathdate(&$page, $action = '')
     {
         $page->changeTpl('fusionax/deathdate_issues.tpl');
diff --git a/templates/fusionax/education.tpl b/templates/fusionax/education.tpl
new file mode 100644 (file)
index 0000000..2e376ca
--- /dev/null
@@ -0,0 +1,49 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  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> / formations</h2>
+
+<p>
+  Il y a {$missingEducationCount} université{if $missingEducationCount > 1}s{/if} manquante{if $missingEducationCount > 1}s{/if} dans
+  notre base{if $missingEducationCount eq 0}.</p>{else}&nbsp;:
+</p>
+<ul>
+  {iterate from=$missingEducation item=education}<li>{$education.Intitule_diplome}</li>{/iterate}
+</ul>{/if}
+
+<p>
+  Il y a {$missingDegreeCount} diplôme{if $missingDegreeCount > 1}s{/if} manquant{if $missingDegreeCount > 1}s{/if} dans
+  notre base{if $missingDegreeCount eq 0}.</p>{else}&nbsp;:
+</p>
+<ul>
+  {iterate from=$missingDegree item=degree}<li>{$degree.Intitule_formation}</li>{/iterate}
+</ul>{/if}
+
+<p>
+  Il y a {$missingCoupleCount} couple{if $missingCoupleCount > 1}s{/if} manquant{if $missingCoupleCount > 1}s{/if} dans
+  notre base{if $missingCoupleCount eq 0}.</p>{else}&nbsp;:
+</p>
+<ul>
+  {iterate from=$missingCouple item=couple}<li>{$couple.edu}, {$couple.degree} ({$couple.eduid}, {$couple.degreeid})</li>{/iterate}
+</ul>{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index edadc0c..39762a3 100644 (file)
@@ -35,6 +35,7 @@
   <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">noms</a></li>
+  <li>Corrélation des <a href="fusionax/edu">formations</a></li>
 </ul>
 
 <p>