From c7139c07c6b79ac1c1792ae771f48e20510ba030 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 6 Nov 2008 00:43:51 +0100 Subject: [PATCH] Splits jobs interface between user and entreprise data, polishes user related part, updates business sectors, adapts search (Closes #16, Closes #528). --- htdocs/css/default.css | 12 ++ htdocs/javascript/profile.js | 33 ++++- modules/profile.php | 23 +++- modules/profile/jobs.inc.php | 201 ++++++++++++++++------------- modules/search.php | 63 +++++---- modules/search/classes.inc.php | 11 +- modules/search/search.inc.php | 10 +- templates/include/emails.combobox.tpl | 4 +- templates/profile/jobs.job.tpl | 80 +++++++----- templates/profile/jobs.secteur.tpl | 13 +- templates/profile/jobs.soussecteur.tpl | 31 +++++ templates/search/adv.form.tpl | 4 +- upgrade/merge-0.0.1/connect.db.inc.php | 32 +++++ upgrade/newdirectory-0.0.1/11_jobs.sql | 43 ++++++ upgrade/newdirectory-0.0.1/12_secteurs.sql | 87 +++++++++++++ 15 files changed, 481 insertions(+), 166 deletions(-) create mode 100644 templates/profile/jobs.soussecteur.tpl create mode 100644 upgrade/merge-0.0.1/connect.db.inc.php create mode 100644 upgrade/newdirectory-0.0.1/11_jobs.sql create mode 100644 upgrade/newdirectory-0.0.1/12_secteurs.sql diff --git a/htdocs/css/default.css b/htdocs/css/default.css index 70e0fed..a164cfa 100644 --- a/htdocs/css/default.css +++ b/htdocs/css/default.css @@ -228,6 +228,18 @@ td.action { } td.action a { padding: 0px 2px 0px 2px; } +div.titre { + color: #000000; + background: inherit; + font-weight: bold; +} + +span.titre { + color: #000000; + background: inherit; + font-weight: bold; +} + /******************************************************************************* 4 Tableau de choix de skins [ Styles pour les tableaux de types de ceux des skins ] diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index 315fc38..64dc174 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -50,6 +50,8 @@ function wizPage_onLoad(id) for (var i = 0 ; document.getElementById('job_' + i) != null ; ++i) { updateJobSecteur(i, 'job_' + i, 'jobs[' + i + ']', document.forms.prof_annu["jobs[" + i + "][ss_secteur]"].value); + updateJobSousSecteur(i, 'job_' + i, 'jobs[' + i + ']', + document.forms.prof_annu["jobs[" + i + "][sss_secteur]"].value); } setTimeout('registerEnterpriseAutocomplete(-1)', 100); break; @@ -503,7 +505,22 @@ function updateJobSecteur(nb, id, pref, sel) if (secteur == '') { secteur = '-1'; } - Ajax.update_html(id + '_ss_secteur', 'profile/ajax/secteur/' +nb + '/' + secteur + '/' + sel); + Ajax.update_html(id + '_ss_secteur', 'profile/ajax/secteur/' + nb + '/' + id + '/' + pref + '/' + secteur + '/' + sel); +} + +function updateJobSousSecteur(nb, id, pref, sel) +{ + var ssecteur = document.forms.prof_annu[pref + '[ss_secteur]'].value; + if (ssecteur == '') { + ssecteur = '-1'; + } + Ajax.update_html(id + '_sss_secteur', 'profile/ajax/ssecteur/' + nb + '/' + ssecteur + '/' + sel); +} + +function displayAllSector() +{ + $('.sector_text').remove(); + $('.sector').show(); } function makeAddJob(id) @@ -671,6 +688,20 @@ function registerEnterpriseAutocomplete(id) } } ); + + $(".sector_name").each( + function() { + if (id == -1 || this.name == "jobs[" + id + "][sss_secteur_name]") { + $(this).autocomplete(platal_baseurl + "search/autocomplete/sss_secteur", + { + selectOnly:1, + field:this.name, + matchSubset:0, + width:$(this).width() + }); + } + } + ); } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/modules/profile.php b/modules/profile.php index a7b4b1b..7f77793 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -39,6 +39,7 @@ class ProfileModule extends PLModule 'profile/networking' => $this->make_hook('networking', AUTH_PUBLIC), 'profile/ajax/job' => $this->make_hook('ajax_job', AUTH_COOKIE, 'user', NO_AUTH), 'profile/ajax/secteur' => $this->make_hook('ajax_secteur', AUTH_COOKIE, 'user', NO_AUTH), + 'profile/ajax/ssecteur' => $this->make_hook('ajax_ssecteur', AUTH_COOKIE, 'user', NO_AUTH), 'profile/ajax/skill' => $this->make_hook('ajax_skill', AUTH_COOKIE, 'user', NO_AUTH), 'profile/ajax/searchname' => $this->make_hook('ajax_searchname', AUTH_COOKIE, 'user', NO_AUTH), 'javascript/education.js' => $this->make_hook('education_js', AUTH_COOKIE), @@ -472,16 +473,30 @@ class ProfileModule extends PLModule $page->assign('fonctions', $res->fetchAllAssoc()); } - function handler_ajax_secteur(&$page, $id, $sect, $ssect = -1) + function handler_ajax_secteur(&$page, $id, $jobid, $jobpref, $sect, $ssect = -1) { header('Content-Type: text/html; charset=utf-8'); - $res = XDB::iterator("SELECT id, label - FROM emploi_ss_secteur - WHERE secteur = {?}", $sect); + $res = XDB::iterator("SELECT id, name AS label, FIND_IN_SET('optgroup', flags) AS optgroup + FROM profile_job_subsector_enum + WHERE sectorid = {?}", $sect); $page->changeTpl('profile/jobs.secteur.tpl', NO_SKIN); $page->assign('id', $id); $page->assign('ssecteurs', $res); $page->assign('sel', $ssect); + $page->assign('jobid', $jobid); + $page->assign('jobpref', $jobpref); + } + + function handler_ajax_ssecteur(&$page, $id, $ssect, $sssect = -1) + { + header('Content-Type: text/html; charset=utf-8'); + $res = XDB::iterator("SELECT id, name AS label + FROM profile_job_subsubsector_enum + WHERE subsectorid = {?}", $ssect); + $page->changeTpl('profile/jobs.soussecteur.tpl', NO_SKIN); + $page->assign('id', $id); + $page->assign('sssecteurs', $res); + $page->assign('sel', $sssect); } function handler_ajax_skill(&$page, $cat, $id) diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index fce8920..5d95ae4 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -30,16 +30,16 @@ class ProfileJob extends ProfileGeoloc public function __construct() { - $this->pub = new ProfilePub(); + $this->pub = new ProfilePub(); $this->mail - = $this->mail_new - = new ProfileEmail(); - $this->web = new ProfileWeb(); - $this->bool = new ProfileBool(); - $this->checks = array('web' => array('web'), - 'mail_new' => array('email_new'), - 'mail' => array('email'), - 'pub' => array('pub', 'email_pub')); + = $this->mail_new + = new ProfileEmail(); + $this->web = new ProfileWeb(); + $this->bool = new ProfileBool(); + $this->checks = array('web' => array('w_web'), + 'mail_new' => array('w_email_new'), + 'mail' => array('w_email'), + 'pub' => array('pub', 'w_email_pub')); } private function cleanJob(ProfilePage &$page,$jobid, array &$job, &$success) @@ -48,9 +48,9 @@ class ProfileJob extends ProfileGeoloc foreach ($this->checks as $obj=>&$fields) { $chk =& $this->$obj; foreach ($fields as $field) { - if ($field == "email_new") { - if ($job['email'] == "new@example.org") { - $job['email'] = $job[$field]; + if ($field == "w_email_new") { + if ($job['w_email'] == "new@example.org") { + $job['w_email'] = $job[$field]; } continue; } @@ -61,18 +61,48 @@ class ProfileJob extends ProfileGeoloc } } } - $job['adr']['pub'] = $this->pub->value($page, 'adr_pub', @$job['adr']['pub'], $s); - $job['adr']['checked'] = $this->bool->value($page, 'adr_checked', @$job['adr']['checked'], $s); - if (!isset($job['tel'])) { - $job['tel'] = array(); + if (!isset($job['sss_secteur_name'])) { + $res = XDB::query("SELECT name + FROM profile_job_subsubsector_enum + WHERE id = {?}", + $job['sss_secteur']); + $job['sss_secteur_name'] = $res->fetchOneCell(); + } else { + $res = XDB::query("SELECT sectorid, subsectorid, id + FROM profile_job_subsubsector_enum + WHERE name = {?}", + $job['sss_secteur_name']); + if ($res->numRows() != 1) { + $success = false; + $job['sector_error'] = true; + } else { + list($job['secteur'], $job['ss_secteur'], $job['sss_secteur']) = $res->fetchOneRow(); + } + } + if (!isset($job['jobid'])) { + $res = XDB::query("SELECT id + FROM profile_job_enum + WHERE name = {?}", + $job['name']); + if ($res->numRows() != 1) { + $success = false; + $job['name_error'] = true; + } else { + $job['jobid'] = $res->fetchOneCell(); + } + } + $job['w_adr']['pub'] = $this->pub->value($page, 'adr_pub', @$job['w_adr']['pub'], $s); + $job['w_adr']['checked'] = $this->bool->value($page, 'adr_checked', @$job['w_adr']['checked'], $s); + if (!isset($job['w_tel'])) { + $job['w_tel'] = array(); } $profiletel = new ProfilePhones('pro', $jobid); - $job['tel'] = $profiletel->value($page, 'tel', $job['tel'], $s); + $job['w_tel'] = $profiletel->value($page, 'tel', $job['w_tel'], $s); unset($job['removed']); unset($job['new']); - unset($job['adr']['changed']); - unset($job['adr']['parsevalid']); - unset($job['adr']['display']); + unset($job['w_adr']['changed']); + unset($job['w_adr']['parsevalid']); + unset($job['w_adr']['display']); } public function value(ProfilePage &$page, $field, $value, &$success) @@ -90,7 +120,7 @@ class ProfileJob extends ProfileGeoloc } foreach ($value as $key=>&$job) { $ls = true; - $this->geolocAddress($job['adr'], $s); + $this->geolocAddress($job['w_adr'], $s); $ls = ($ls && $s); $this->cleanJob($page, $key, $job, $s); $ls = ($ls && $s); @@ -104,7 +134,7 @@ class ProfileJob extends ProfileGeoloc public function save(ProfilePage &$page, $field, $value) { require_once('profil.func.inc.php'); - XDB::execute("DELETE FROM entreprises + XDB::execute("DELETE FROM profile_job WHERE uid = {?}", S::i('uid')); XDB::execute("DELETE FROM profile_phones @@ -112,32 +142,16 @@ class ProfileJob extends ProfileGeoloc S::i('uid')); $i = 0; foreach ($value as $jobid=>&$job) { - if ($job['email'] == "new@example.org") { - $job['email'] = $job['email_new']; + if ($job['w_email'] == "new@example.org") { + $job['w_email'] = $job['w_email_new']; } - XDB::execute("INSERT INTO entreprises (uid, entrid, entreprise, secteur, ss_secteur, - fonction, poste, adr1, adr2, adr3, postcode, - city, cityid, country, region, regiontxt, - email, web, - pub, adr_pub, email_pub, flags, - glat, glng) - VALUES ({?}, {?}, {?}, {?}, {?}, - {?}, {?}, {?}, {?}, {?}, {?}, - {?}, {?}, {?}, {?}, {?}, - {?}, {?}, - {?}, {?}, {?}, {?}, - {?}, {?})", - S::i('uid'), $i, $job['name'], $job['secteur'], $job['ss_secteur'], - $job['fonction'], $job['poste'], $job['adr']['adr1'], $job['adr']['adr2'], $job['adr']['adr3'], - $job['adr']['postcode'], - $job['adr']['city'], $job['adr']['cityid'], $job['adr']['country'], $job['adr']['region'], - $job['adr']['regiontxt'], - $job['email'], $job['web'], - $job['pub'], $job['adr']['pub'], $job['email_pub'], - $job['adr']['checked'] ? 'geoloc' : '', $job['adr']['precise_lat'], - $job['adr']['precise_lon']); + XDB::execute("INSERT INTO profile_job (uid, id, functionid, description, sectorid, subsectorid, + subsubsectorid, email, url, pub, email_pub, jobid) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})", + S::i('uid'), $i, $job['fonction'], $job['description'], $job['secteur'], $job['ss_secteur'], + $job['sss_secteur'], $job['w_email'], $job['w_web'], $job['pub'], $job['w_email_pub'], $job['jobid']); $profiletel = new ProfilePhones('pro', $jobid); - $profiletel->saveTels('tel', $job['tel']); + $profiletel->saveTels('tel', $job['w_tel']); $i++; } } @@ -174,50 +188,55 @@ class ProfileJobs extends ProfilePage $this->values['corps'] = $res->fetchOneAssoc(); // Build the jobs tree - $res = XDB::iterRow("SELECT e.entrid, e.entreprise, e.secteur, e.ss_secteur, - e.fonction, e.poste, e.adr1, e.adr2, e.adr3, + $res = XDB::iterRow("SELECT j.id, je.name, j.functionid, j.sectorid, j.subsectorid, + j.subsubsectorid, j.description, e.adr1, e.adr2, e.adr3, e.postcode, e.city, e.cityid, e.region, e.regiontxt, e.country, gp.pays, gp.display, FIND_IN_SET('geoloc', flags), - e.email, e.web, e.pub, - e.adr_pub, e.email_pub, - e.glat AS precise_lat, e.glng AS precise_lon - FROM entreprises AS e - LEFT JOIN geoloc_pays AS gp ON(gp.a2 = e.country) - WHERE e.uid = {?} AND entreprise != '' + j.email, j.url, j.pub, + e.adr_pub, j.email_pub, + e.glat, e.glng, s.name + FROM profile_job AS j + LEFT JOIN profile_job_enum AS je ON (j.jobid = je.id) + LEFT JOIN entreprises AS e ON (j.uid = e.uid AND j.id = e.entrid) + LEFT JOIN geoloc_pays AS gp ON (gp.a2 = e.country) + LEFT JOIN profile_job_subsubsector_enum AS s ON (s.id = j.subsubsectorid) + WHERE j.uid = {?} ORDER BY entrid", S::i('uid')); $this->values['jobs'] = array(); - while (list($id, $name, $secteur, $ss_secteur, $fonction, $poste, - $adr1, $adr2, $adr3, $postcode, $city, $cityid, - $region, $regiontxt, $country, $countrytxt, $display, - $checked, $email, $web, - $pub, $adr_pub, $email_pub, $glat, $glng + while (list($id, $name, $function, $secteur, $ss_secteur, $sss_secteur, $description, + $w_adr1, $w_adr2, $w_adr3, $w_postcode, $w_city, $w_cityid, + $w_region, $w_regiontxt, $w_country, $w_countrytxt, $w_display, + $w_checked, $w_email, $w_web, + $pub, $w_adr_pub, $w_email_pub, $w_glat, $w_glng, $sss_secteur_name ) = $res->next()) { - $this->values['jobs'][] = array('id' => $id, - 'name' => $name, - 'secteur' => $secteur, - 'ss_secteur' => $ss_secteur, - 'fonction' => $fonction, - 'poste' => $poste, - 'adr' => array('adr1' => $adr1, - 'adr2' => $adr2, - 'adr3' => $adr3, - 'postcode' => $postcode, - 'city' => $city, - 'cityid' => $cityid, - 'region' => $region, - 'regiontxt' => $regiontxt, - 'country' => $country, - 'countrytxt' => $countrytxt, - 'display' => $display, - 'pub' => $adr_pub, - 'checked' => $checked, - 'precise_lat'=> $glat, - 'precise_lon'=> $glng), - 'email' => $email, - 'web' => $web, - 'pub' => $pub, - 'email_pub' => $email_pub); + $this->values['jobs'][] = array('id' => $id, + 'name' => $name, + 'fonction' => $function, + 'secteur' => $secteur, + 'ss_secteur' => $ss_secteur, + 'sss_secteur' => $sss_secteur, + 'sss_secteur_name' => $sss_secteur_name, + 'description' => $description, + 'w_adr' => array('adr1' => $w_adr1, + 'adr2' => $w_adr2, + 'adr3' => $w_adr3, + 'postcode' => $w_postcode, + 'city' => $w_city, + 'cityid' => $w_cityid, + 'region' => $w_region, + 'regiontxt' => $w_regiontxt, + 'country' => $w_country, + 'countrytxt' => $w_countrytxt, + 'display' => $w_display, + 'pub' => $w_adr_pub, + 'checked' => $w_checked, + 'precise_lat' => $w_glat, + 'precise_lon' => $w_glng), + 'w_email' => $w_email, + 'w_web' => $w_web, + 'pub' => $pub, + 'w_email_pub' => $w_email_pub); } $res = XDB::iterator("SELECT link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment @@ -237,16 +256,16 @@ class ProfileJobs extends ProfilePage break; } $job =& $this->values['jobs'][$i]; - if (!isset($job['tel'])) { - $job['tel'] = array(); + if (!isset($job['w_tel'])) { + $job['w_tel'] = array(); } if ($job['id'] == $jobid) { - $job['tel'][] = $tel; + $job['w_tel'][] = $tel; } } foreach ($this->values['jobs'] as $id=>&$job) { - if (!isset($job['tel'])) { - $job['tel'] = array(); + if (!isset($job['w_tel'])) { + $job['w_tel'] = array(); } unset($job['id']); } @@ -276,8 +295,8 @@ class ProfileJobs extends ProfilePage require_once "emails.combobox.inc.php"; fill_email_combobox($page); - $page->assign('secteurs', XDB::iterator("SELECT id, label - FROM emploi_secteur")); + $page->assign('secteurs', XDB::iterator("SELECT id, name AS label + FROM profile_job_sector_enum")); $page->assign('fonctions', XDB::iterator("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) AS title FROM fonctions_def ORDER BY id")); diff --git a/modules/search.php b/modules/search.php index 582de73..9761dd4 100644 --- a/modules/search.php +++ b/modules/search.php @@ -166,7 +166,7 @@ class SearchModule extends PLModule $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), + 'secteur' => array('field' => 'id', 'table' => 'profile_job_sector_enum', 'text' => 'name', 'exact' => false), 'nationalite' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'nat', 'exact' => 'false'), 'binet' => array('field' => 'id', 'table' => 'binets_def', 'text' => 'text', 'exact' => false), 'networking_type' => array('field' => 'network_type', 'table' => 'profile_networking_enum', @@ -251,6 +251,7 @@ class SearchModule extends PLModule $beginwith = true; $field2 = false; $qsearch = str_replace(array('%', '_'), '', $q); + $distinct = true; switch ($type) { case 'binetTxt': @@ -283,20 +284,21 @@ class SearchModule extends PLModule $realid = '`geoloc_pays`.`a2`'; break; case 'entreprise': - $db = '`entreprises`'; - $field = '`entreprise`'; - $unique = '`uid`'; + $db = 'profile_job_enum INNER JOIN + profile_job ON (profile_job.jobid = profile_job_enum.id)'; + $field = 'profile_job_enum.name'; + $unique = 'profile_job.uid'; break; case 'firstname': $field = '`prenom`'; $beginwith = false; break; case 'fonctionTxt': - $db = '`fonctions_def` INNER JOIN - `entreprises` ON(`entreprises`.`fonction` = `fonctions_def`.`id`)'; - $field = '`fonction_fr`'; - $unique = '`uid`'; - $realid = '`fonctions_def`.`id`'; + $db = 'fonctions_def INNER JOIN + profile_job ON (profile_job.fonctionid = fonctions_def.id)'; + $field = 'fonction_fr'; + $unique = 'uid'; + $realid = 'fonctions_def.id'; $beginwith = false; break; case 'groupexTxt': @@ -331,10 +333,10 @@ class SearchModule extends PLModule $db = '`auth_user_quick`'; $beginwith = false; break; - case 'poste': - $db = '`entreprises`'; - $field = '`poste`'; - $unique = '`uid`'; + case 'description': + $db = 'profile_job'; + $field = 'description'; + $unique = 'uid'; break; case 'schoolTxt': $db = 'profile_education_enum INNER JOIN @@ -346,12 +348,19 @@ class SearchModule extends PLModule $beginwith = false; break; case 'secteurTxt': - $db = '`emploi_secteur` INNER JOIN - `entreprises` ON(`entreprises`.`secteur` = `emploi_secteur`.`id`)'; - $field = '`emploi_secteur`.`label`'; - $realid = '`emploi_secteur`.`id`'; - $unique = '`uid`'; + $db = 'profile_job_sector_enum INNER JOIN + profile_job ON (profile_job.sectorid = profile_job_sector_enum.id)'; + $field = 'profile_job_sector_enum.name'; + $realid = 'profile_job_sector_enum.id'; + $unique = 'uid'; + $beginwith = false; + break; + case 'sss_secteur': + $db = 'profile_job_subsubsector_enum'; + $field = 'name'; $beginwith = false; + $unique = 'name'; + $distinct = false; break; case 'sectionTxt': $db = '`sections` INNER JOIN @@ -378,14 +387,14 @@ class SearchModule extends PLModule $field2_t = make_field_test($field2, $beginwith); $field_select = 'IF(' . $field_t . ', ' . $field . ', ' . $field2. ')'; } - $list = XDB::iterator('SELECT ' . $field_select . ' AS field, - COUNT(DISTINCT ' . $unique . ') AS nb - ' . ($realid ? (', ' . $realid . ' AS id') : '') . ' + $list = XDB::iterator('SELECT ' . $field_select . ' AS field' + . ($distinct ? (', COUNT(DISTINCT ' . $unique . ') AS nb') : '') + . ($realid ? (', ' . $realid . ' AS id') : '') . ' FROM ' . $db . ' WHERE ' . $field_t . ($field2 ? (' OR ' . $field2_t) : '') . ' GROUP BY ' . $field_select . ' - ORDER BY nb DESC + ORDER BY ' . ($distinct ? 'nb DESC' : $field_select) . ' LIMIT 11', $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch, $qsearch); @@ -398,7 +407,9 @@ class SearchModule extends PLModule $res .= $q."|-1\n"; } else { $res .= $result['field'].'|'; - $res .= $result['nb']; + if (isset($result['nb'])) { + $res .= $result['nb']; + } if (isset($result['id'])) { $res .= '|'.$result['id']; } @@ -474,8 +485,10 @@ class SearchModule extends PLModule $db = '`sections`'; break; case 'secteur': - $db = '`emploi_secteur`'; - $field = '`label`'; + $db = 'profile_job_sector_enum INNER JOIN + profile_job ON (profile_job.sectorid = profile_job_sector_enum.id)'; + $field = 'profile_job_sector_enum.name'; + $id = 'profile_job_sector_enum.id'; break; default: exit(); } diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index 0fefe5d..6d81622 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -37,7 +37,7 @@ edu2.grad_year AS edugrad_year2, f2.field AS edufield2, edu2.program AS eduprogram2, ede3.name AS eduname3, ede3.url AS eduurl3, edd3.degree AS edudegree3, edu3.grad_year AS edugrad_year3, f3.field AS edufield3, edu3.program AS eduprogram3, - es.label AS secteur, ef.fonction_fr AS fonction, + es.name AS secteur, ef.fonction_fr AS fonction, IF(n1.nat=\'\',n1.pays,n1.nat) AS nat1, n1.a2 AS iso3166_1, IF(n2.nat=\'\',n2.pays,n2.nat) AS nat2, n2.a2 AS iso3166_2, IF(n3.nat=\'\',n3.pays,n3.nat) AS nat3, n3.a2 AS iso3166_3, @@ -47,7 +47,7 @@ if (S::logged()) $globals->search->result_fields .=' q.profile_freetext AS freetext, adr.city, gp.pays AS countrytxt, gr.name AS region, - e.entreprise, + ee.name, nw.address AS networking_address, nwe.name AS networking_name,'; else @@ -56,7 +56,7 @@ else IF(adr.pub='public', adr.city, '') AS city, IF(adr.pub='public', gp.pays, '') AS countrytxt, IF(adr.pub='public', gr.name, '') AS region, - IF(e.pub='public', e.entreprise, '') AS entreprise, + IF(e.pub='public', ee.name, '') AS entreprise, IF(nw.pub='public', nw.address, '') AS networking_address, IF(nw.pub='public', nwe.name, '') AS networking_name,"; @$globals->search->result_where_statement = ' @@ -76,8 +76,9 @@ else LEFT JOIN profile_education_enum AS ede3 ON (ede3.id = edu3.eduid) LEFT JOIN profile_education_degree_enum AS edd3 ON (edd3.id = edu3.degreeid) LEFT JOIN profile_education_field_enum AS f3 ON (f3.id = edu3.fieldid) - 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 profile_job AS e ON (e.uid = u.user_id) + LEFT JOIN profile_job_enum AS ee ON (e.jobid = ee.id) + LEFT JOIN profile_job_sector_enum AS es ON (es.id = e.sectorid) LEFT JOIN fonctions_def AS ef ON (e.fonction = ef.id) LEFT JOIN geoloc_pays AS n1 ON (u.nationalite = n1.a2) LEFT JOIN geoloc_pays AS n2 ON (u.nationalite2 = n2.a2) diff --git a/modules/search/search.inc.php b/modules/search/search.inc.php index e988faf..9c4a8a2 100644 --- a/modules/search/search.inc.php +++ b/modules/search/search.inc.php @@ -57,10 +57,12 @@ function advancedSearchFromInput() $mapField = new MapSField('mapid', array('sgcim.map_id'), array('adresses', 'geoloc_city_in_maps'), array('amp', 'sgcim'), array(getadr_join('amp'), 'amp.cityid = sgcim.city_id')); - $entrepriseField = new RefSField('entreprise', array('ee.entreprise'), 'entreprises', 'ee', 'u.user_id = ee.uid', false); - $posteField = new RefSField('poste', array('ep.poste'), 'entreprises', 'ep', 'u.user_id = ep.uid', false); - $fonctionField = new RefSField('fonction', array('en.fonction'), 'entreprises', 'en', 'u.user_id = en.uid'); - $secteurField = new RefSField('secteur', array('fm.secteur'), 'entreprises', 'fm', 'u.user_id = fm.uid'); + $entrepriseField = new RefSField('entreprise', array('ee.name'), 'profile_job_enum', 'ee', + 'u.user_id = profile_job.uid AND profile_job.jobid = profile_job_enum.id', false); + $posteField = new RefSField('poste', array('ep.description'), 'profile_job', 'ep', 'u.user_id = ep.uid', false); + $fonctionField = new RefSField('fonction', array('en.fonction_fr'), 'fonctions_def', 'en', + 'u.user_id = profile_job.uid AND fonctions_def.id = profile_job.functionid'); + $secteurField = new RefSField('secteur', array('fm.sectorid'), 'profile_job', 'fm', 'u.user_id = fm.uid'); $cvField = new RefSField('cv', array('u.cv'), '', '', '', false); $natField = new RefSField('nationalite', array('u.nationalite', 'u.nationalite2', 'u.nationalite3'), '', '', ''); diff --git a/templates/include/emails.combobox.tpl b/templates/include/emails.combobox.tpl index c5cce09..628d33a 100644 --- a/templates/include/emails.combobox.tpl +++ b/templates/include/emails.combobox.tpl @@ -81,13 +81,13 @@ {icon name="flag_orange" title="Visible sur l'annuaire"} {elseif $name neq "email"} - {include file="include/flags.radio.tpl" name="`$jobpref`[email_pub]" val=$job.mail_pub} + {include file="include/flags.radio.tpl" name="`$jobpref`[`$prefix`email_pub]" val=$pub} {/if}