* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: advanced_search.php,v 1.20 2004-10-24 14:21:30 x2000bedo Exp $
+ $Id: advanced_search.php,v 1.21 2004-10-29 01:24:20 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
function form_prepare() {
global $page,$globals;
$page->assign('formulaire',1);
- $sql = 'SELECT id,text FROM nationalites ORDER BY text';
+ $sql = 'SELECT a2 AS id,IF(nat=\'\',pays,nat) AS text FROM geoloc_pays ORDER BY text';
$page->mysql_assign($sql,'choix_nationalites');
$sql = 'SELECT id,text FROM binets_def ORDER BY text';
$page->mysql_assign($sql,'choix_binets');
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: fiche.php,v 1.15 2004-10-27 18:02:29 x2000coic Exp $
+ $Id: fiche.php,v 1.16 2004-10-29 01:24:20 x2000habouzit Exp $
***************************************************************************/
else
$where_clause = " WHERE u.matricule = '{$_REQUEST['mat']}'";
-$reqsql = "SELECT u.prenom, u.nom, u.epouse, nationalites.text,
+$reqsql = "SELECT u.prenom, u.nom, u.epouse, IF(gp.nat='',gp.pays,gp.nat) AS text
u.user_id, a.alias, a2.alias, u.matricule, i.deces != 0 as dcd,
i.deces, u.date, u.cv, sections.text, u.mobile, u.web,
u.libre, u.promo, c.uid IS NOT NULL, p.x, p.y
FROM auth_user_md5 AS u
- INNER JOIN aliases AS a ON (u.user_id=a.id AND a.type='a_vie')
+ INNER JOIN aliases AS a ON (u.user_id=a.id AND a.type='a_vie')
INNER JOIN aliases AS a2 ON (u.user_id=a2.id AND (a2.type='alias' OR a2.type='epouse') AND a2.alias LIKE '%.%')
- LEFT JOIN contacts AS c ON (c.uid = {$_SESSION['uid']} and c.contact = u.user_id)
- INNER JOIN nationalites ON(nationalites.id = u.nationalite)
+ LEFT JOIN contacts AS c ON (c.uid = {$_SESSION['uid']} and c.contact = u.user_id)
+ INNER JOIN geoloc_pays AS gp ON (gp.a2 = u.nationalite)
INNER JOIN sections ON(sections.id = u.section)
INNER JOIN identification AS i ON(u.matricule = i.matricule)
LEFT JOIN photo as p ON(p.uid = u.user_id)".$where_clause."
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: mescontacts.php,v 1.19 2004-10-28 20:28:41 x2000habouzit Exp $
+ $Id: mescontacts.php,v 1.20 2004-10-29 01:24:20 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
a.*, l.alias AS forlife,
i.deces != 0 AS dcd, i.deces, i.matricule_ax, FIND_IN_SET('femme', i.flags) AS sexe,
e.entreprise, es.label AS secteur, ef.fonction_fr AS fonction,
- n.text AS nat, n.iso3166,
+ IF(n.nat='',n.pays,n.nat) AS nat, n.a2 AS iso3166,
ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type,
ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type,
adr.ville, gp.a2, gp.pays, gr.name AS region,
LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = a.user_id)
LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id)
LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id)
- LEFT JOIN nationalites AS n ON (a.nationalite = n.id)
+ LEFT JOIN geoloc_pays AS n ON (a.nationalite = n.a2)
LEFT JOIN applis_ins AS ai0 ON (a.user_id = ai0.uid AND ai0.ordre = 0)
LEFT JOIN applis_def AS ad0 ON (ad0.id = ai0.aid)
LEFT JOIN applis_ins AS ai1 ON (a.user_id = ai1.uid AND ai1.ordre = 1)
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: search.classes.inc.php,v 1.26 2004-10-28 12:20:59 x2000habouzit Exp $
+ $Id: search.classes.inc.php,v 1.27 2004-10-29 01:24:20 x2000habouzit Exp $
***************************************************************************/
require_once("xorg.misc.inc.php");
ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type,
ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type,
e.entreprise, es.label AS secteur, ef.fonction_fr AS fonction,
- n.text AS nat, n.iso3166,
+ IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166,
adr.ville, gp.pays, gr.name AS region,';
$globals->search_result_where_statement = '
LEFT JOIN applis_ins AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
LEFT JOIN entreprises AS e ON (e.entrid = 0 AND e.uid = u.user_id)
LEFT JOIN emploi_secteur AS es ON (e.secteur = es.id)
LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id)
- LEFT JOIN nationalites AS n ON (u.nationalite = n.id)
+ LEFT JOIN geoloc_pays AS n ON (u.nationalite = n.a2)
LEFT JOIN adresses AS adr ON (u.user_id = adr.uid AND FIND_IN_SET(\'active\',adr.statut))
LEFT JOIN geoloc_pays AS gp ON (adr.pays = gp.a2)
LEFT JOIN geoloc_region AS gr ON (adr.pays = gr.a2 AND adr.region = gr.region)';
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 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 *
+ ***************************************************************************
+ $Id: function.select_nat.php,v 1.1 2004-10-29 01:24:21 x2000habouzit Exp $
+ ***************************************************************************/
+
+
+function select_nat($valeur,$pad=false) {
+ global $globals;
+ $sql = "SELECT a2 AS id,IF(nat='',pays,nat) AS text FROM geoloc_pays ORDER BY text";
+ $result = $globals->db->query($sql);
+
+ $sel = ' selected="selected"';
+
+ // on ajoute une entree vide si $pad est vrai
+ $html = "";
+ if ($pad)
+ $html.= '<option value="0"'.($valeur==0?$sel:"")."></option>\n";
+ while (list($my_id,$my_text) = mysql_fetch_row($result)) {
+ $html .= sprintf("<option value=\"%s\" %s>%s</option>\n",$my_id,($valeur==$my_id?$sel:""),$my_text);
+ }
+ mysql_free_result($result);
+ return $html;
+}
+
+function smarty_function_select_nat($params, &$smarty) {
+ if(empty($params['pad']) || !($params['pad']))
+ $pad = false;
+ else
+ $pad = true;
+ return select_nat($params['valeur'], $pad);
+}
+
+?>
replace INTO `nationalites` VALUES (19,'Chilien','CL');
replace INTO `nationalites` VALUES (20,'Chinois','CN');
replace INTO `nationalites` VALUES (21,'Colombien','CO');
+replace INTO `nationalites` VALUES (22,'Coréen','KR');
+replace INTO `nationalites` VALUES (86,'Costaricien','CR');
replace INTO `nationalites` VALUES (80,'Croate','HR');
replace INTO `nationalites` VALUES (23,'Cubain','CU');
replace INTO `nationalites` VALUES (24,'Danois','DK');
replace INTO `nationalites` VALUES (78,'Vietnamien','VN');
replace INTO `nationalites` VALUES (79,'Yougoslave','CS');
+alter table geoloc_pays add column nat varchar(100) not null;
+update geoloc_pays inner join nationalites ON iso3166=a2 set nat=text;
+update auth_user_md5 set nationalite='' where nationalite='0' or nationalite='36';
+alter table auth_user_md5 change column nationalite nationalite varchar(2) not null;
+update auth_user_md5 AS u
+ inner join nationalites AS n ON u.nationalite=n.id
+ inner join geoloc_pays AS g ON iso3166=a2
+ set u.nationalite = a2;
+
+drop table nationalites;
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: step2.tpl,v 1.4 2004-10-24 14:41:13 x2000habouzit Exp $
+ $Id: step2.tpl,v 1.5 2004-10-29 01:24:21 x2000habouzit Exp $
***************************************************************************}
</td>
<td>
<select name="nationalite">
- {select_db_table table="nationalites" valeur=$smarty.request.nationalite}
+ {select_nat valeur=$smarty.request.nationalite}
</select>
</td>
</tr>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: general.tpl,v 1.14 2004-10-09 05:57:48 x2000habouzit Exp $
+ $Id: general.tpl,v 1.15 2004-10-29 01:24:22 x2000habouzit Exp $
***************************************************************************}
</td>
<td class="cold">
<select name="nationalite">
- {select_db_table table="nationalites" valeur=$nationalite}
+ {select_nat valeur=$nationalite}
</select>
</td>
</tr>