Merge remote branch 'origin/xorg/maint' into xorg/1.0.2/master
[platal.git] / plugins / function.select_nat.php
index 9a73f39..551e0e6 100644 (file)
 
 
 function select_nat($valeur, $pad=false) {
-    $res = XDB::iterRow("SELECT  iso_3166_1_a2 AS id, nationalityFR AS text
+    $res = XDB::iterRow("SELECT  iso_3166_1_a2 AS id, nationality AS text
                            FROM  geoloc_countries
-                          WHERE  nationalityFR IS NOT NULL
-                       ORDER BY  nationalityFR");
+                          WHERE  nationality IS NOT NULL
+                       ORDER BY  nationality");
     $sel = ' selected="selected"';
 
     // on ajoute une entree vide si $pad est vrai
     $html = "";
     if ($pad) {
-             $html .= sprintf("<option value=\"\"%s></option>\n", ($valeur ? $sel : ""));
+             $html .= sprintf("<option value=\"\"%s>&nbsp;</option>\n", ($valeur ? $sel : ""));
     }
     while (list($my_id, $my_text) = $res->next()) {
-        $html .= sprintf("<option value=\"%s\"%s>%s</option>\n", $my_id, ($valeur==$my_id ? $sel : ""), $my_text);
+        $html .= sprintf("<option value=\"%s\"%s>%s</option>\n", $my_id, ($valeur==$my_id ? $sel : ""), $my_text?$my_text:"&nbsp;");
     }
 
     return $html;