+ $textFields = array(
+ 'country' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'pays', 'exact' => false),
+ 'fonction' => array('field' => 'id', 'table' => 'fonctions_def', 'text' => 'fonction_fr', 'exact' => true),
+ 'secteur' => array('field' => 'id', 'table' => 'emploi_secteur', 'text' => 'label', 'exact' => false),
+ 'nationalite' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'nat', 'exact' => 'false'),
+ 'binet' => array('field' => 'id', 'table' => 'binets_def', 'text' => 'text', 'exact' => false),
+ 'groupex' => array('field' => 'id', 'table' => 'groupex.asso',
+ 'text' => "(a.cat = 'GroupesX' OR a.cat = 'Institutions') AND pub = 'public' AND nom",
+ 'exact' => false),
+ 'section' => array('field' => 'id', 'table' => 'sections', 'text' => 'text', 'exact' => false),
+ 'school' => array('field' => 'id', 'table' => 'applis_def', 'text' => 'text', 'exact' => false),
+ 'city' => array('table' => 'geoloc_city', 'text' => 'name', 'exact' => false)
+ );
+ foreach ($textFields as $field=>&$query) {
+ if (!Env::v($field) && Env::v($field . 'Txt')) {
+ $res = XDB::query("SELECT {$query['field']}
+ FROM {$query['table']}
+ WHERE {$query['text']} " . ($query['exact'] ? " = {?}" :
+ " LIKE CONCAT('%', {?}, '%')"),
+ Env::v($field . 'Txt'));
+ $_REQUEST[$field] = $res->fetchOneCell();
+ }
+ }
+