2 /***************************************************************************
3 * Copyright (C) 2003-2010 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
23 * Module to merge data from AX database: this will only be used once on
24 * production site and should be removed afterwards.
26 * Module to import data from another database of alumni that had
27 * different schemas. The organization that used this db is called AX
28 * hence the name of this module.
30 * Datas are stored in an export file.
32 class FusionAxModule
extends PLModule
37 'fusionax' => $this->make_hook('index', AUTH_MDP
, 'admin'),
38 'fusionax/import' => $this->make_hook('import', AUTH_MDP
, 'admin'),
39 'fusionax/view' => $this->make_hook('view', AUTH_MDP
, 'admin'),
40 'fusionax/ids' => $this->make_hook('ids', AUTH_MDP
, 'admin'),
41 'fusionax/deceased' => $this->make_hook('deceased', AUTH_MDP
, 'admin'),
42 'fusionax/promo' => $this->make_hook('promo', AUTH_MDP
, 'admin'),
43 'fusionax/names' => $this->make_hook('names', AUTH_MDP
, 'admin'),
48 function handler_index(&$page)
50 $page->changeTpl('fusionax/index.tpl');
51 $page->assign('xorg_title', 'Polytechnique.org - Fusion des annuaires');
54 /** Import de l'annuaire de l'AX depuis l'export situé dans le home de jacou */
55 function handler_import(&$page, $action = 'index', $file = '')
57 if ($action == 'index') {
58 $page->changeTpl('fusionax/import.tpl');
62 // toutes les actions sont faites en ajax en utilisant jquery
63 header('Content-type: text/javascript; charset=utf-8');
68 $modulepath = realpath(dirname(__FILE__
) . '/fusionax/') . '/';
69 $spoolpath = realpath(dirname(__FILE__
) . '/../spool/fusionax/') . '/';
71 if ($action == 'launch') {
73 $report[] = 'Nom de fichier non renseigné.';
74 } elseif (!file_exists(dirname(__FILE__
) . '/../spool/fusionax/' . $file)) {
75 $report[] = 'Le fichier ne se situe pas au bon endroit.';
77 // séparation de l'archive en fichiers par tables
78 $file = $spoolpath . $file;
79 // Removes master and doctorate students
80 exec('grep -v "^[A-Z]\{2\}.[0-9]\{4\}[MD][0-9]\{3\}" ' . $file . ' > ' . $file . '.tmp');
81 exec('mv -f ' . $file . '.tmp ' . $file);
82 // Split export into specialised files
83 exec('grep "^AD" ' . $file . ' > ' . $spoolpath . 'Adresses.txt');
84 exec('grep "^AN" ' . $file . ' > ' . $spoolpath . 'Anciens.txt');
85 exec('grep "^FO" ' . $file . ' > ' . $spoolpath . 'Formations.txt');
86 exec('grep "^AC" ' . $file . ' > ' . $spoolpath . 'Activites.txt');
87 exec('grep "^EN" ' . $file . ' > ' . $spoolpath . 'Entreprises.txt');
88 exec($modulepath . 'formation.pl');
89 exec('mv -f ' . $spoolpath . 'Formations_out.txt ' . $spoolpath . 'Formations.txt');
90 $report[] = 'Fichier parsé.';
91 $report[] = 'Import dans la base en cours...';
92 $next = 'integrateSQL';
94 } elseif ($action == 'integrateSQL') {
95 // intégration des données dans la base MySQL
96 // liste des fichiers sql à exécuter
101 3 => 'Formations.sql',
102 4 => 'Entreprises.sql'
105 // récupère le contenu du fichier sql
106 $queries = explode(';', file_get_contents($modulepath . $filesSQL[$file]));
107 foreach ($queries as $q) {
109 // coupe le fichier en requêtes individuelles
110 if (substr($q, 0, 2) == '--') {
111 // affiche les commentaires dans le report
112 $lines = explode("\n", $q);
114 $report[] = addslashes($l);
116 // exécute la requête
117 XDB
::execute(str_replace('{?}', $spoolpath, $q));
120 // trouve le prochain fichier à exécuter
121 $nextfile = $file +
1;
126 // tous les fichiers ont été exécutés, on passe à l'étape suivante
129 // on passe au fichier suivant
130 $next = 'integrateSQL/' . $nextfile;
132 } elseif ($action == 'adds1920') {
133 // Adds promotion 1920 from AX db.
134 $report[] = 'Ajout de la promotion 1920';
135 $res = XDB
::iterator('SELECT prenom, Nom_complet, ax_id
136 FROM fusionax_anciens
137 WHERE promotion_etude = 1920;');
139 $nameTypes = DirEnum
::getOptions(DirEnum
::NAMETYPES
);
140 $nameTypes = array_flip($nameTypes);
141 $eduSchools = DirEnum
::getOptions(DirEnum
::EDUSCHOOLS
);
142 $eduSchools = array_flip($eduSchools);
143 $eduDegrees = DirEnum
::getOptions(DirEnum
::EDUDEGREES
);
144 $eduDegrees = array_flip($eduDegrees);
145 $degreeid = $eduDegrees[Profile
::DEGREE_X
];
149 $sex = PlUser
::GENDER_MALE
;
153 while (list($firstname, $lastname, $ax_id) = $res->next()) {
154 $hrid = self
::getHrid($firstname, $lastname, $promo);
155 $res1 = XDB
::query('SELECT COUNT(*)
157 WHERE hruid = {?}', $hrid);
158 $res2 = XDB
::query('SELECT COUNT(*)
160 WHERE hrpid = {?}', $hrid);
161 if (is_null($hrid) ||
$res1->fetchOneCell() > 0 ||
$res2->fetchOneCell() > 0) {
162 $report[] = $ax_id . ' non ajouté';
164 $fullName = $firstname . ' ' . $lastname;
165 $directoryName = $lastname . ' ' . $firstname;
168 XDB
::execute('REPLACE INTO profiles (hrpid, xorg_id, ax_id, sex)
169 VALUES ({?}, {?}, {?}, {?})',
170 $hrid, $xorgId, $ax_id, $sex);
171 $pid = XDB
::insertId();
172 XDB
::execute('REPLACE INTO profile_name (pid, name, typeid)
173 VALUES ({?}, {?}, {?})',
174 $pid, $lastname, $nameTypes['name_ini']);
175 XDB
::execute('REPLACE INTO profile_name (pid, name, typeid)
176 VALUES ({?}, {?}, {?})',
177 $pid, $firstname, $nameTypes['firstname_ini']);
178 XDB
::execute('REPLACE INTO profile_display (pid, yourself, public_name, private_name,
179 directory_name, short_name, sort_name, promo)
180 VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
181 $pid, $firstname, $fullName, $fullName, $directoryName, $fullName, $directoryName, $promo);
182 XDB
::execute('REPLACE INTO profile_education (pid, eduid, degreeid, entry_year, grad_year, flags)
183 VALUES ({?}, {?}, {?}, {?}, {?}, {?})',
184 $pid, $eduSchools[Profile
::EDU_X
], $degreeid, $entry_year, $grad_year, 'primary');
185 XDB
::execute('REPLACE INTO accounts (hruid, type, is_admin, state, full_name, directory_name, display_name, sex)
186 VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})',
187 $hrid, $type, 0, 'active', $fullName, $directoryName, $lastname, $sex);
188 $uid = XDB
::insertId();
189 XDB
::execute('REPLACE INTO account_profiles (uid, pid, perms)
190 VALUES ({?}, {?}, {?})',
191 $uid, $pid, 'owner');
193 $report[] = 'Promo 1920 ajoutée.';
195 } elseif ($action == 'view') {
196 XDB
::execute('CREATE OR REPLACE ALGORITHM=MERGE VIEW fusionax_xorg_anciens AS
197 SELECT p.pid, p.ax_id, pd.promo, pd.private_name, pd.public_name,
198 pd.sort_name, pd.short_name, pd.directory_name
200 INNER JOIN profile_display AS pd USING(pid)');
202 } elseif ($action == 'clean') {
203 // nettoyage du fichier temporaire
204 exec('rm -Rf ' . $spoolpath);
205 $report[] = 'Import finit.';
207 foreach($report as $t) {
208 // affiche les lignes de report
209 echo "$('#fusionax').append('" . $t . "<br/>');\n";
212 // lance le prochain script s'il y en a un
213 echo "$.getScript('fusionax/import/" . $next . "');";
215 // exit pour ne pas afficher la page template par défaut
219 function handler_view(&$page, $action = '')
221 $page->changeTpl('fusionax/view.tpl');
222 if ($action == 'create') {
223 XDB
::execute('DROP VIEW IF EXISTS fusionax_deceased');
224 XDB
::execute('CREATE VIEW fusionax_deceased AS
225 SELECT p.pid, a.ax_id, pd.private_name, pd.promo, p.deathdate AS deces_xorg, a.Date_deces AS deces_ax
227 INNER JOIN profile_display AS pd ON (p.pid = pd.pid)
228 INNER JOIN fusionax_anciens AS a ON (a.ax_id = p.ax_id)
229 WHERE p.deathdate != a.Date_deces');
230 XDB
::execute('DROP VIEW IF EXISTS fusionax_promo');
231 XDB
::execute('CREATE VIEW fusionax_promo AS
232 SELECT p.pid, p.ax_id, pd.private_name, pd.promo, pe.entry_year AS promo_etude_xorg,
233 f.promotion_etude AS promo_etude_ax, pe.grad_year AS promo_sortie_xorg
235 INNER JOIN profile_display AS pd ON (p.pid = pd.pid)
236 INNER JOIN profile_education AS pe ON (p.pid = pe.pid)
237 INNER JOIN fusionax_anciens AS f ON (p.ax_id = f.ax_id)
238 WHERE pd.promo != CONCAT(\'X\', f.promotion_etude)
239 AND !(f.promotion_etude = pe.entry_year + 1 AND pe.grad_year = pe.entry_year + 4)');
240 $page->trigSuccess('Les VIEW ont bien été créées.');
244 /* Mets à NULL le matricule_ax de ces camarades pour marquer le fait qu'ils ne figurent pas dans l'annuaire de l'AX */
245 private static function clear_wrong_in_xorg($pid)
247 $res = XDB
::execute('UPDATE fusionax_xorg_anciens
249 WHERE pid = {?}', $pid);
253 return XDB
::affectedRows() / 2;
256 /* Cherche les les anciens présents dans Xorg avec un matricule_ax ne correspondant à rien dans la base de l'AX
257 * (mises à part les promo 1921 et 1923 qui ne figurent pas dans les données de l'AX)*/
258 private static function find_wrong_in_xorg($limit = 10)
260 return XDB
::iterator('SELECT u.promo, u.pid, u.private_name
261 FROM fusionax_xorg_anciens AS u
262 WHERE NOT EXISTS (SELECT *
263 FROM fusionax_anciens AS f
264 WHERE f.ax_id = u.ax_id)
265 AND u.ax_id IS NOT NULL AND promo != \'X1921\' AND promo != \'X1923\'');
268 /** Lier les identifiants d'un ancien dans les deux annuaires
269 * @param user_id identifiant dans l'annuaire X.org
270 * @param matricule_ax identifiant dans l'annuaire de l'AX
271 * @return 0 si la liaison a échoué, 1 sinon
273 private static function link_by_ids($pid, $ax_id)
275 $res = XDB
::execute('UPDATE fusionax_import AS i
276 INNER JOIN fusionax_xorg_anciens AS u
277 SET u.ax_id = i.ax_id,
279 i.date_match_id = NOW()
280 WHERE i.ax_id = {?} AND u.pid = {?}
281 AND (u.ax_id != {?} OR u.ax_id IS NULL
282 OR i.pid != {?} OR i.pid IS NULL)',
283 $ax_id, $pid, $ax_id, $pid);
287 return XDB
::affectedRows() / 2;
290 /** Recherche automatique d'anciens à lier entre les deux annuaires
291 * @param limit nombre d'anciens à trouver au max
292 * @param sure si true, ne trouve que des anciens qui sont quasi sûrs
293 * @return un XOrgDBIterator sur les entrées avec display_name, promo,
294 * pid, ax_id et display_name_ax
296 private static function find_easy_to_link($limit = 10, $sure = false
)
298 $easy_to_link = XDB
::iterator("
299 SELECT u.private_name, u.promo, u.pid, ax.ax_id,
300 CONCAT(ax.prenom, ' ', ax.nom_complet, ' (X', ax.promotion_etude, ')') AS display_name_ax,
301 COUNT(*) AS nbMatches
302 FROM fusionax_anciens AS ax
303 INNER JOIN fusionax_import AS i ON (i.ax_id = ax.ax_id AND i.pid IS NULL)
304 LEFT JOIN fusionax_xorg_anciens AS u ON (u.ax_id IS NULL
305 AND u.promo = CONCAT('X', ax.promotion_etude)
306 AND (CONCAT(ax.prenom, ' ', ax.nom_complet) = u.private_name
307 OR CONCAT(ax.prenom, ' ', ax.nom_complet) = u.public_name
308 OR CONCAT(ax.prenom, ' ', ax.nom_complet) = u.short_name))
310 HAVING u.pid IS NOT NULL AND nbMatches = 1" . ($limit ?
(' LIMIT ' . $limit) : ''));
311 if ($easy_to_link->total() > 0 ||
$sure) {
312 return $easy_to_link;
314 return XDB
::iterator("
315 SELECT u.private_name, u.promo, u.pid, ax.ax_id,
316 CONCAT(ax.prenom, ' ', ax.nom_complet, ' (X', ax.promotion_etude, ')') AS display_name_ax,
317 COUNT(*) AS nbMatches
318 FROM fusionax_anciens AS ax
319 INNER JOIN fusionax_import AS i ON (i.ax_id = ax.ax_id AND i.pid IS NULL)
320 LEFT JOIN fusionax_xorg_anciens AS u ON (u.ax_id IS NULL
321 AND (CONCAT(ax.prenom, ' ', ax.nom_complet) = u.private_name
322 OR CONCAT(ax.prenom, ' ', ax.nom_complet) = u.public_name
323 OR CONCAT(ax.prenom, ' ', ax.nom_complet) = u.short_name)
324 AND u.promo < CONCAT('X', ax.promotion_etude + 2)
325 AND u.promo > CONCAT('X', ax.promotion_etude - 2))
327 HAVING u.pid IS NOT NULL AND nbMatches = 1" . ($limit ?
(' LIMIT ' . $limit) : ''));
330 /** Module de mise en correspondance les ids */
331 function handler_ids(&$page, $part = 'main', $pid = null
, $ax_id = null
)
334 $page->assign('xorg_title', 'Polytechnique.org - Fusion - Mise en correspondance simple');
336 if ($part == 'missingInAX') {
337 // locate all persons from this database that are not in AX's
338 $page->changeTpl('fusionax/idsMissingInAx.tpl');
339 $missingInAX = XDB
::iterator('SELECT promo, pid, private_name
340 FROM fusionax_xorg_anciens
341 WHERE ax_id IS NULL');
342 $page->assign('missingInAX', $missingInAX);
345 if ($part == 'missingInXorg') {
346 // locate all persons from AX's database that are not here
347 $page->changeTpl('fusionax/idsMissingInXorg.tpl');
348 $missingInXorg = XDB
::iterator("SELECT CONCAT(a.prenom, ' ', a.Nom_usuel) AS private_name,
349 a.promotion_etude AS promo, a.ax_id
351 INNER JOIN fusionax_anciens AS a USING (ax_id)
352 WHERE fusionax_import.pid IS NULL");
353 $page->assign('missingInXorg', $missingInXorg);
356 if ($part == 'wrongInXorg') {
357 // locate all persons from Xorg database that have a bad AX id
358 $page->changeTpl('fusionax/idswrongInXorg.tpl');
359 $wrongInXorg = FusionAxModule
::find_wrong_in_xorg($nbToLink);
360 $page->assign('wrongInXorg', $wrongInXorg);
363 if ($part == 'cleanwronginxorg') {
364 $linksToDo = FusionAxModule
::find_wrong_in_xorg($nbToLink);
365 while ($l = $linksToDo->next()) {
366 FusionAxModule
::clear_wrong_in_xorg($l['pid']);
368 pl_redirect('fusionax/ids/wrongInXorg');
370 if ($part == 'lier') {
371 if (Post
::has('user_id') && Post
::has('matricule_ax')) {
372 FusionAxModule
::link_by_ids(Post
::i('pid'), Post
::v('ax_id'));
375 if ($part == 'link') {
376 FusionAxModule
::link_by_ids($pid, $ax_id);
379 if ($part == 'linknext') {
380 $linksToDo = FusionAxModule
::find_easy_to_link($nbToLink);
381 while ($l = $linksToDo->next()) {
382 FusionAxModule
::link_by_ids($l['pid'], $l['ax_id']);
384 pl_redirect('fusionax/ids#autolink');
386 if ($part == 'linkall') {
387 $linksToDo = FusionAxModule
::find_easy_to_link(0);
388 while ($l = $linksToDo->next()) {
389 FusionAxModule
::link_by_ids($l['pid'], $l['ax_id']);
393 $page->changeTpl('fusionax/ids.tpl');
394 $missingInAX = XDB
::query('SELECT COUNT(*)
395 FROM fusionax_xorg_anciens
396 WHERE ax_id IS NULL');
398 $page->assign('nbMissingInAX', $missingInAX->fetchOneCell());
400 $missingInXorg = XDB
::query('SELECT COUNT(*)
403 if ($missingInXorg) {
404 $page->assign('nbMissingInXorg', $missingInXorg->fetchOneCell());
406 $wrongInXorg = FusionAxModule
::find_wrong_in_xorg($nbToLink);
407 if ($wrongInXorg->total() > 0) {
408 $page->assign('wrongInXorg', $wrongInXorg->total());
410 $easyToLink = FusionAxModule
::find_easy_to_link($nbToLink);
411 if ($easyToLink->total() > 0) {
412 $page->assign('nbMatch', $easyToLink->total());
413 $page->assign('easyToLink', $easyToLink);
418 function handler_deceased(&$page, $action = '')
420 if ($action == 'updateXorg') {
421 XDB
::execute('UPDATE fusionax_deceased
422 SET deces_xorg = deces_ax
423 WHERE deces_xorg = "0000-00-00"');
425 if ($action == 'updateAX') {
426 XDB
::execute('UPDATE fusionax_deceased
427 SET deces_ax = deces_xorg
428 WHERE deces_ax = "0000-00-00"');
430 if ($action == 'update') {
431 if (Post
::has('pid') && Post
::has('date')) {
432 XDB
::execute('UPDATE fusionax_deceased
433 SET deces_ax = {?}, deces_xorg = {?}
435 Post
::v('date'), Post
::v('date'), Post
::i('pid'));
438 $page->changeTpl('fusionax/deceased.tpl');
440 $deceasedErrorsSql = XDB
::query('SELECT COUNT(*) FROM fusionax_deceased');
441 $page->assign('deceasedErrors', $deceasedErrorsSql->fetchOneCell());
442 $res = XDB
::iterator('SELECT pid, ax_id, promo, private_name, deces_ax
443 FROM fusionax_deceased
444 WHERE deces_xorg = "0000-00-00"
446 $page->assign('nbDeceasedMissingInXorg', $res->total());
447 $page->assign('deceasedMissingInXorg', $res);
448 $res = XDB
::iterator('SELECT pid, ax_id, promo, private_name, deces_xorg
449 FROM fusionax_deceased
450 WHERE deces_ax = "0000-00-00"
452 $page->assign('nbDeceasedMissingInAX', $res->total());
453 $page->assign('deceasedMissingInAX', $res);
454 $res = XDB
::iterator('SELECT pid, ax_id, promo, private_name, deces_xorg, deces_ax
455 FROM fusionax_deceased
456 WHERE deces_xorg != "0000-00-00" AND deces_ax != "0000-00-00"');
457 $page->assign('nbDeceasedDifferent', $res->total());
458 $page->assign('deceasedDifferent', $res);
461 function handler_promo(&$page, $action = '')
463 $page->changeTpl('fusionax/promo.tpl');
464 $res = XDB
::iterator('SELECT pid, private_name, promo_etude_xorg, promo_sortie_xorg, promo_etude_ax, promo
466 WHERE !(promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 3 = promo_sortie_xorg)
467 AND !(promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 4 = promo_sortie_xorg)
468 AND !(promo_etude_ax = promo_etude_xorg + 1)
469 ORDER BY promo_etude_xorg');
470 $nbMissmatchingPromos = $res->total();
471 $page->assign('nbMissmatchingPromos', $res->total());
472 $page->assign('missmatchingPromos', $res);
474 $res = XDB
::iterator('SELECT pid, private_name, promo_etude_xorg, promo_sortie_xorg, promo_etude_ax, promo
476 WHERE promo_etude_ax = promo_etude_xorg + 1
477 ORDER BY promo_etude_xorg');
478 $nbMissmatchingPromos +
= $res->total();
479 $page->assign('nbMissmatchingPromos1', $res->total());
480 $page->assign('missmatchingPromos1', $res);
482 $res = XDB
::iterator('SELECT pid, private_name, promo_etude_xorg, promo_sortie_xorg, promo_etude_ax, promo
484 WHERE promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 3 = promo_sortie_xorg
485 ORDER BY promo_etude_xorg');
486 $nbMissmatchingPromos +
= $res->total();
487 $page->assign('nbMissmatchingPromos2', $res->total());
488 $page->assign('missmatchingPromos2', $res);
490 $res = XDB
::iterator('SELECT pid, private_name, promo_etude_xorg, promo_sortie_xorg, promo_etude_ax, promo
492 WHERE promo_etude_ax + 1 = promo_etude_xorg AND promo_etude_xorg + 4 = promo_sortie_xorg
493 ORDER BY promo_etude_xorg');
494 $nbMissmatchingPromos +
= $res->total();
495 $page->assign('nbMissmatchingPromos3', $res->total());
496 $page->assign('missmatchingPromos3', $res);
498 $page->assign('nbMissmatchingPromosTotal', $nbMissmatchingPromos);
501 function handler_names(&$page, $action = '')
503 $page->changeTpl('fusionax/names.tpl');
505 $res = XDB
::query('SELECT COUNT(*)
506 FROM fusionax_anciens AS f
507 INNER JOIN profiles AS p ON (f.ax_id = p.ax_id)');
508 $page->assign('total', $res->fetchOneCell());
512 // | lastname_marital | 2 |
513 // | lastname_ordinary | 3 |
515 // | firstname_ordinary | 7 |
516 // | firstname_other | 8 |
517 // | name_other | 9 |
519 // | firstname_ini | 11 |
520 $res = XDB
::query("SELECT COUNT(*)
521 FROM fusionax_anciens AS f
522 INNER JOIN profiles AS p ON (f.ax_id = p.ax_id)
523 LEFT JOIN profile_name AS pnp ON (p.pid = pnp.pid AND pnp.typeid = 1)
524 LEFT JOIN profile_name AS pnm ON (p.pid = pnm.pid AND pnm.typeid = 2)
525 LEFT JOIN profile_name AS pno ON (p.pid = pno.pid AND pno.typeid = 3)
526 LEFT JOIN profile_name AS pne ON (p.pid = pne.pid AND pne.typeid = 9)
527 LEFT JOIN profile_name AS pni ON (p.pid = pni.pid AND pni.typeid = 10)
528 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)
529 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)
530 OR f.Nom_complet NOT IN (pnp.name, pno.name, pnm.name, pne.name, pni.name)");
531 $page->assign('lastnameIssues', $res->fetchOneCell());
533 $res = XDB
::query('SELECT COUNT(*)
534 FROM fusionax_anciens AS f
535 INNER JOIN profiles AS p ON (f.ax_id = p.ax_id)
536 LEFT JOIN profile_name AS pnf ON (p.pid = pnf.pid AND pnf.typeid = 4)
537 LEFT JOIN profile_name AS pno ON (p.pid = pno.pid AND pno.typeid = 7)
538 LEFT JOIN profile_name AS pne ON (p.pid = pne.pid AND pne.typeid = 8)
539 LEFT JOIN profile_name AS pni ON (p.pid = pni.pid AND pni.typeid = 11)
540 WHERE f.prenom NOT IN (pnf.name, pno.name, pne.name, pni.name)');
541 $page->assign('firstnameIssues', $res->fetchOneCell());
546 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: