S::i('uid'));
foreach ($value as $id=>&$job) {
if ($job['jobid']) {
- XDB::execute("INSERT INTO profile_job (uid, id, functionid, description, sectorid, subsectorid,
+ XDB::execute("INSERT INTO profile_job (uid, id, description, sectorid, subsectorid,
subsubsectorid, email, url, pub, email_pub, jobid)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
- S::i('uid'), $id, $job['fonction'], $job['description'], $job['sector'], $job['subSector'],
+ S::i('uid'), $id, $job['description'], $job['sector'], $job['subSector'],
$job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub'], $job['jobid']);
} else {
- XDB::execute("INSERT INTO profile_job (uid, id, functionid, description, sectorid, subsectorid,
+ XDB::execute("INSERT INTO profile_job (uid, id, description, sectorid, subsectorid,
subsubsectorid, email, url, pub, email_pub)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
- S::i('uid'), $id, $job['fonction'], $job['description'], $job['sector'], $job['subSector'],
+ S::i('uid'), $id, $job['description'], $job['sector'], $job['subSector'],
$job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub']);
}
$address = new ProfileAddress();
$this->values['corps'] = $res->fetchOneAssoc();
// Build the jobs tree
- $res = XDB::iterRow("SELECT j.id, j.jobid, je.name, j.functionid, j.sectorid, j.subsectorid, j.subsubsectorid,
+ $res = XDB::iterRow("SELECT j.id, j.jobid, je.name, j.sectorid, j.subsectorid, j.subsubsectorid,
s.name, j.description, j.email, j.email_pub, j.url, j.pub,
je.acronym, je.url, je.email,
aw.accuracy, aw.text, aw.postalText, aw.postalCode, aw.localityId,
ORDER BY j.id",
S::i('uid'));
$this->values['jobs'] = array();
- while (list($id, $jobid, $name, $function, $sector, $subSector, $subSubSector,
+ while (list($id, $jobid, $name, $sector, $subSector, $subSubSector,
$subSubSectorName, $description, $w_email, $w_emailPub, $w_url, $pub,
$hq_acronym, $hq_url, $hq_email,
$w_accuracy, $w_text, $w_postalText, $w_postalCode, $w_localityId,
$this->values['jobs'][] = array('id' => $id,
'jobid' => $jobid,
'name' => $name,
- 'function' => $function,
'sector' => $sector,
'subSector' => $subSector,
'subSubSector' => $subSubSector,
$res = XDB::query("SELECT id, name AS label
FROM profile_job_sector_enum");
$page->assign('sectors', $res->fetchAllAssoc());
- $res = XDB::query("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) AS title
- FROM fonctions_def
- ORDER BY id");
- $page->assign('functions', $res->fetchAllAssoc());
$res = XDB::iterator("SELECT id, name
FROM profile_corps_enum
id TINYINT(1) UNSIGNED NOT NULL,
uid INT(11) NOT NULL DEFAULT 0,
jobid INT(6) UNSIGNED NOT NULL DEFAULT 0,
- functionid SMALLINT(3) UNSIGNED NOT NULL DEFAULT 0,
sectorid TINYINT(2) UNSIGNED NOT NULL DEFAULT 0,
subsectorid TINYINT(3) UNSIGNED NOT NULL DEFAULT 0,
subsubsectorid SMALLINT(3) UNSIGNED NOT NULL DEFAULT 0,
SELECT entreprise, web
FROM entreprises;
-INSERT INTO profile_job (id, uid, jobid, description, email, pub, email_pub, functionid)
- SELECT e.entrid, e.uid, j.id, e.poste, e.email, e.pub, e.email_pub, e.fonction
- FROM entreprises AS e
- INNER JOIN profile_job_enum AS j ON (e.entreprise = j.name);
-
-DROP TABLE IF EXISTS profile_job_function_enum;
-
-CREATE TABLE IF NOT EXISTS profile_job_function_enum (
- id SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
- name VARCHAR(255) NOT NULL DEFAULT '',
- PRIMARY KEY (id),
- UNIQUE KEY (name)
-) CHARSET=utf8;
+INSERT INTO profile_job (id, uid, jobid, email, pub, email_pub, description)
+ SELECT e.entrid, e.uid, j.id, e.email, e.pub, e.email_pub,
+ CONCAT_WS(', ', IF(e.poste = '', NULL, e.poste), IF(e.fonction = 0, NULL, f.fonction_fr),
+ IF(e.ss_secteur IS NULL , IF(e.secteur IS NULL, NULL, s.label), ss.label))
+ FROM entreprises AS e
+ INNER JOIN profile_job_enum AS j ON (e.entreprise = j.name)
+ LEFT JOIN fonctions_def AS f ON (f.id = e.fonction)
+ LEFT JOIN emploi_ss_secteur AS ss ON (ss.id = e.ss_secteur)
+ LEFT JOIN emploi_secteur AS s ON (s.id = e.secteur);
-- vim:set syntax=mysql: