Allows users to add a new entreprise.
authorStéphane Jacob <jacou@melix.net>
Mon, 10 Nov 2008 00:37:54 +0000 (01:37 +0100)
committerStéphane Jacob <jacou@melix.net>
Tue, 9 Dec 2008 12:05:03 +0000 (13:05 +0100)
12 files changed:
htdocs/javascript/profile.js
include/validations.inc.php
include/validations/entreprises.inc.php [new file with mode: 0644]
modules/profile.php
modules/profile/general.inc.php
modules/profile/jobs.inc.php
modules/profile/page.inc.php
templates/include/form.valid.edit-entreprises.tpl [new file with mode: 0644]
templates/include/form.valid.entreprises.tpl [new file with mode: 0644]
templates/profile/jobs.job.tpl
upgrade/newdirectory-0.0.1/11_jobs.sql
upgrade/newdirectory-0.0.1/12_secteurs.sql

index 64dc174..f8c3fbc 100644 (file)
@@ -517,10 +517,10 @@ function updateJobSousSecteur(nb, id, pref, sel)
     Ajax.update_html(id + '_sss_secteur', 'profile/ajax/ssecteur/' + nb + '/' + ssecteur + '/' + sel);
 }
 
-function displayAllSector()
+function displayAllSector(id)
 {
-    $('.sector_text').remove();
-    $('.sector').show();
+    $('.sector_text_' + id).remove();
+    $('.sector_' + id).show();
 }
 
 function makeAddJob(id)
@@ -542,6 +542,10 @@ function addJob()
     $.get(platal_baseurl + 'profile/ajax/job/' + i, makeAddJob(i));
 }
 
+function addEntreprise(id)
+{
+    $('.entreprise_' + id).toggle();
+}
 
 // Skills
 
index 97e1b15..9b3e1f7 100644 (file)
@@ -87,7 +87,7 @@ abstract class Validate
         $this->type   = $_type;
         $res = XDB::query("SELECT  promo_display AS promo
                              FROM  profile_display
-                            WHERE  uid={?}", $_uid);
+                            WHERE  uid={?}", $this->user->id());
         $this->promo = $res->fetchOneCell();
     }
 
diff --git a/include/validations/entreprises.inc.php b/include/validations/entreprises.inc.php
new file mode 100644 (file)
index 0000000..2e1cd9a
--- /dev/null
@@ -0,0 +1,162 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2008 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                *
+ ***************************************************************************/
+
+// {{{ class EntrReq
+
+class EntrReq extends Validate
+{
+    // {{{ properties
+
+    public $id;
+    public $name;
+    public $acronym;
+    public $url;
+    public $email;
+    public $holdingid;
+    public $NAF_code;
+    public $AX_code;
+
+    public $tel;
+    public $fax;
+
+    //TODO: addresses
+
+    // }}}
+    // {{{ constructor
+
+    public function __construct(User &$_user, $_id, $_name, $_acronym, $_url, $_email, $_tel, $_fax, $_stamp = 0)
+    {
+        parent::__construct($_user, true, 'entreprise', $_stamp);
+        $this->id        = $_id;
+        $this->name      = $_name;
+        $this->acronym   = $_acronym;
+        $this->url       = $_url;
+        $this->email     = $_email;
+        $this->tel       = $_tel;
+        $this->fax       = $_fax;
+    }
+
+    // }}}
+    // {{{ function formu()
+
+    public function formu()
+    {
+        return 'include/form.valid.entreprises.tpl';
+    }
+
+    // }}}
+    // {{{ function editor()
+
+    public function editor()
+    {
+        return 'include/form.valid.edit-entreprises.tpl';
+    }
+
+    // }}}
+    // {{{ function handle_editor()
+
+    protected function handle_editor()
+    {
+        if (Env::has('holdingid')) {
+            $this->holdingid = trim(Env::v('holdingid'));
+        }
+        if (Env::has('name')) {
+            $this->name = trim(Env::v('name'));
+            if (Env::has('acronym')) {
+                $this->acronym = trim(Env::v('acronym'));
+                if (Env::has('url')) {
+                    $this->url = trim(Env::v('url'));
+                    if (Env::has('NAF_code')) {
+                        $this->NAF_code = trim(Env::v('NAF_code'));
+                        if (Env::has('AX_code')) {
+                            $this->AX_code = trim(Env::v('AX_code'));
+                            return true;
+                        }
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    // }}}
+    // {{{ function _mail_subj
+
+    protected function _mail_subj()
+    {
+        return "[Polytechnique.org/Entreprises] Demande d'ajout d'une entreprise : " . $this->name;
+    }
+
+    // }}}
+    // {{{ function _mail_body
+
+    protected function _mail_body($isok)
+    {
+        if ($isok) {
+            return "  L'entreprise " . $this->name . " vient d'être ajoutée à ta fiche.";
+        } else {
+            return "  La demande que tu avais faite pour l'entreprise " . $this->name .
+                   " a été refusée, car elle figure déjà dans notre base.";
+        }
+    }
+
+    // }}}
+    // {{{ function commit()
+
+    public function commit()
+    {
+        $res = XDB::query('SELECT  id
+                             FROM  profile_job_enum
+                            WHERE  name = {?}',
+                          $this->name);
+        if ($res->numRows() != 1) {
+            require_once("profil.func.inc.php");
+
+            XDB::execute('INSERT INTO  profile_job_enum (name, acronym, url, email, holdingid, NAF_code, AX_code)
+                               VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})',
+                         $this->name, $this->acronym, $this->url, $this->email,
+                         $this->holdingid, $this->NAF_code, $this->AX_code);
+            $jobid = XDB::insertId();
+            $display_tel = format_display_number($this->tel, $error_tel);
+            $display_fax =format_display_number($this->fax, $error_fax);
+            XDB::execute('INSERT INTO  profile_phones (uid, link_type, link_id, tel_id, tel_type,
+                                       search_tel, display_tel, pub)
+                               VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}),
+                                       ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
+                         $jobid, 'hq', $this->id, 0, 'fixed', format_phone_number($this->tel), $display_tel, 'public', 
+                         $jobid, 'hq', $this->id, 1, 'fax', format_phone_number($this->fax), $display_fax, 'public');
+        } else {
+            $jobid = $res->fetchOneCell();
+            $success = true;
+        }
+        return XDB::execute('UPDATE  profile_job
+                                SET  jobid = {?}
+                              WHERE  uid = {?} AND id = {?}',
+                            $jobid, $this->user->id(), $this->id);
+    }
+
+    // }}}
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
index 21b3ed9..6fe8ad3 100644 (file)
@@ -464,8 +464,8 @@ class ProfileModule extends PLModule
         $page->assign('i', $id);
         $page->assign('job', array());
         $page->assign('new', true);
-        $res = XDB::query("SELECT  id, label
-                             FROM  emploi_secteur");
+        $res = XDB::query("SELECT  id, name AS label
+                             FROM  profile_job_sector_enum");
         $page->assign('secteurs', $res->fetchAllAssoc());
         $res = XDB::query("SELECT  id, fonction_fr, FIND_IN_SET('titre', flags) AS title
                              FROM  fonctions_def
index 3f13936..ecb18b3 100644 (file)
@@ -82,9 +82,7 @@ class ProfileSearchName implements ProfileSetting
 
 class ProfileEdu implements ProfileSetting
 {
-    public function __construct()
-    {
-    }
+    public function __construct(){}
 
     static function sortByGradYear($line1, $line2) {
         $a = (int) $line1['grad_year'];
@@ -142,14 +140,12 @@ class ProfileEdu implements ProfileSetting
             }
         }
     }
-
 }
 
 class ProfileEmailDirectory implements ProfileSetting
 {
-    public function __construct()
-    {
-    }
+    public function __construct(){}
+    public function save(ProfilePage &$page, $field, $value){}
 
     public function value(ProfilePage &$page, $field, $value, &$success)
     {
@@ -169,10 +165,6 @@ class ProfileEmailDirectory implements ProfileSetting
         }
         return $value;
     }
-
-    public function save(ProfilePage &$page, $field, $value)
-    {
-    }
 }
 
 class ProfileNetworking implements ProfileSetting
index 7983f8f..e392d46 100644 (file)
@@ -42,7 +42,7 @@ class ProfileJob extends ProfileGeoloc
                               'pub'      => array('pub', 'w_email_pub'));
     }
 
-    private function cleanJob(ProfilePage &$page,$jobid, array &$job, &$success)
+    private function cleanJob(ProfilePage &$page, $jobid, array &$job, &$success)
     {
         $success = true;
         foreach ($this->checks as $obj=>&$fields) {
@@ -61,7 +61,7 @@ class ProfileJob extends ProfileGeoloc
                 }
             }
         }
-        if (!isset($job['sss_secteur_name'])) {
+        if (!$job['sss_secteur_name']) {
             $res = XDB::query("SELECT  name
                                  FROM  profile_job_subsubsector_enum
                                 WHERE  id = {?}",
@@ -79,14 +79,16 @@ class ProfileJob extends ProfileGeoloc
                 list($job['secteur'], $job['ss_secteur'], $job['sss_secteur']) = $res->fetchOneRow();
             }
         }
-        if (!isset($job['jobid'])) {
+        if ($job['name']) {
             $res = XDB::query("SELECT  id
                                  FROM  profile_job_enum
                                 WHERE  name = {?}",
                               $job['name']);
             if ($res->numRows() != 1) {
-                $success = false;
-                $job['name_error'] = true;
+                $user = S::user();
+                $req = new EntrReq($user, $jobid, $job['name'], $job['acronym'], $job['hq_web'], $job['hq_email'], $job['hq_tel'], $job['hq_fax']);
+                $req->submit();
+                $job['jobid'] = null;
             } else {
                 $job['jobid'] = $res->fetchOneCell();
             }
@@ -107,6 +109,10 @@ class ProfileJob extends ProfileGeoloc
 
     public function value(ProfilePage &$page, $field, $value, &$success)
     {
+        require_once('validations.inc.php');
+        $entreprise = Validate::get_typed_requests(S::i('uid'), 'entreprise');
+        $entr_val = 0;
+
         $init = false;
         if (is_null($value)) {
             $value = $page->values['jobs'];
@@ -114,7 +120,12 @@ class ProfileJob extends ProfileGeoloc
         }
         $success = true;
         foreach ($value as $key=>&$job) {
-            if (@$job['removed'] || !trim($job['name'])) {
+            $job['name'] = trim($job['name']);
+            if (!$job['name']) {
+                $job['tmp_name'] = $entreprise[$entr_val]->name;
+                $entr_val ++;
+            }
+            if (@$job['removed']) {
                 unset($value[$key]);
             }
         }
@@ -134,25 +145,33 @@ class ProfileJob extends ProfileGeoloc
     public function save(ProfilePage &$page, $field, $value)
     {
         require_once('profil.func.inc.php');
+        require_once('validations.inc.php');
+
         XDB::execute("DELETE FROM  profile_job
                             WHERE  uid = {?}",
                      S::i('uid'));
         XDB::execute("DELETE FROM  profile_phones
                             WHERE  uid = {?} AND link_type = 'pro'",
                      S::i('uid'));
-        $i = 0;
-        foreach ($value as $jobid=>&$job) {
+        foreach ($value as $id=>&$job) {
             if ($job['w_email'] == "new@example.org") {
                 $job['w_email'] = $job['w_email_new'];
             }
-            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);
+            if ($job['jobid']) {
+                XDB::execute("INSERT INTO  profile_job (uid, id, functionid, description, sectorid, subsectorid,
+                                                        subsubsectorid, email, url, pub, email_pub, jobid)
+                                   VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
+                             S::i('uid'), $id, $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']);
+            } else {
+                XDB::execute("INSERT INTO  profile_job (uid, id, functionid, description, sectorid, subsectorid,
+                                                        subsubsectorid, email, url, pub, email_pub)
+                                   VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
+                             S::i('uid'), $id, $job['fonction'], $job['description'], $job['secteur'], $job['ss_secteur'],
+                             $job['sss_secteur'], $job['w_email'], $job['w_web'], $job['pub'], $job['w_email_pub']);
+            }
+            $profiletel = new ProfilePhones('pro', $id);
             $profiletel->saveTels('tel', $job['w_tel']);
-            $i++;
         }
     }
 }
index d852b5b..6dabf8f 100644 (file)
@@ -119,15 +119,21 @@ class ProfilePhones implements ProfileSetting
 {
     private $tel;
     private $pub;
+    protected $id;
     protected $link_type;
     protected $link_id;
 
-    public function __construct($type, $id)
+    public function __construct($type, $link_id, $id = 0)
     {
+        if ($id != 0) {
+            $this->id = $id;
+        } else {
+            $this->id = S::i('uid');
+        }
         $this->tel = new ProfileTel();
         $this->pub = new ProfilePub();
         $this->link_type = $type;
-        $this->link_id = $id;
+        $this->link_id   = $link_id;
     }
 
     public function value(ProfilePage &$page, $field, $value, &$success)
@@ -135,11 +141,11 @@ class ProfilePhones implements ProfileSetting
         $success = true;
         if (is_null($value) || !is_array($value)) {
             $value = array();
-            $res = XDB::iterator("SELECT t.display_tel AS tel, t.tel_type AS type, t.pub, t.comment
-                                    FROM profile_phones AS t
-                                   WHERE t.uid = {?} AND t.link_type = {?}
-                                ORDER BY t.tel_id",
-                                 S::v('uid'), $this->link_type);
+            $res = XDB::iterator("SELECT  t.display_tel AS tel, t.tel_type AS type, t.pub, t.comment
+                                    FROM  profile_phones AS t
+                                   WHERE  t.uid = {?} AND t.link_type = {?}
+                                ORDER BY  t.tel_id",
+                                 $this->id, $this->link_type);
             $value = $res->fetchAllAssoc();
         }
         foreach ($value as $key=>&$phone) {
@@ -172,8 +178,8 @@ class ProfilePhones implements ProfileSetting
                                        search_tel, display_tel, pub, comment)
                                VALUES  ({?}, {?}, {?}, {?}, {?},
                                        {?}, {?}, {?}, {?})",
-                         S::i('uid'), $this->link_type, $this->link_id, $telid, $phone['type'],
-                        format_phone_number($phone['tel']), $phone['tel'], $phone['pub'], $phone['comment']);
+                         $this->id, $this->link_type, $this->link_id, $telid, $phone['type'],
+                         format_phone_number($phone['tel']), $phone['tel'], $phone['pub'], $phone['comment']);
         }
     }
 
@@ -181,7 +187,7 @@ class ProfilePhones implements ProfileSetting
     {
         XDB::execute("DELETE FROM  profile_phones
                             WHERE  uid = {?} AND link_type = {?} AND link_id = {?}",
-                            S::i('uid'), $this->link_type, $this->link_id);
+                            $this->id, $this->link_type, $this->link_id);
         $this->saveTels($field, $value);
     }
 
diff --git a/templates/include/form.valid.edit-entreprises.tpl b/templates/include/form.valid.edit-entreprises.tpl
new file mode 100644 (file)
index 0000000..89b19e0
--- /dev/null
@@ -0,0 +1,42 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<strong>Nom&nbsp;:</strong>
+<input type="text" name="name" size="25" maxlength="200" value="{$valid->name}" /><br />
+<strong>Acronyme&nbsp;:</strong>
+<input type="text" name="acronym" size="25" maxlength="200" value="{$valid->acronym}" /><br />
+<strong>Site web&nbsp;:</strong>
+<input type="text" name="url" size="25" maxlength="200" value="{$valid->url}" /><br />
+<strong>Email&nbsp;:</strong>
+<input type="text" name="url" size="25" maxlength="200" value="{$valid->email}" /><br />
+<strong>Holding&nbsp;:</strong>
+<input type="text" name="holdingid" size="25" maxlength="200" value="{$valid->holdingid}" /><br />
+<strong>Code NAF&nbsp;:</strong>
+<input type="text" name="NAF_code" size="25" maxlength="200" value="{$valid->NAF_code}" /><br />
+<strong>Code AX&nbsp;:</strong>
+<input type="text" name="AX_code" size="25" maxlength="200" value="{$valid->AX_code}" /><br />
+<strong>Téléphone&nbsp;:</strong>
+<input type="text" name="tel" size="25" maxlength="200" value="{$valid->tel}" /><br />
+<strong>Fax&nbsp;:</strong>
+<input type="text" name="fax" size="25" maxlength="200" value="{$valid->fax}" /><br />
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/include/form.valid.entreprises.tpl b/templates/include/form.valid.entreprises.tpl
new file mode 100644 (file)
index 0000000..f822feb
--- /dev/null
@@ -0,0 +1,66 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+
+<tr class="pair">
+  <td class="titre">Nom&nbsp;:</td>
+  <td>{$valid->name}</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Acronyme&nbsp;:</td>
+  <td>{$valid->acronym}</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Site web&nbsp;:</td>
+  <td>{$valid->url}</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Email&nbsp;:</td>
+  <td>{$valid->email}</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Holding&nbsp;:</td>
+  <td>{$valid->holdingid}</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Code NAF&nbsp;:</td>
+  <td>{$valid->NAF_code}</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Code AX&nbsp;:</td>
+  <td>{$valid->AX_code}</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Téléphone&nbsp;:</td>
+  <td>{$valid->tel}</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Fax&nbsp;:</td>
+  <td>{$valid->fax}</td>
+</tr>
+<tr class="pair">
+  <td colspan="2" class="center">
+    <small>Bien remplir tous les champs, en particulier les <a href="http://societe.com/">codes NAF</a> et AX !</small>
+  </td>
+</tr>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index b12d298..84ce1d1 100644 (file)
@@ -22,6 +22,9 @@
 
 {assign var=jobid value="job_`$i`"}
 {assign var=jobpref value="jobs[`$i`]"}
+{assign var=sector_text value="sector_text_"|cat:$i}
+{assign var=sector value="sector_"|cat:$i}
+{assign var=entreprise value="entreprise_"|cat:$i}
 <div id="{$jobid}">
   <input type="hidden" name="{$jobpref}[removed]" value="0" />
   <input type="hidden" name="{$jobpref}[new]" value="{if $new}1{else}0{/if}" />
     <tr>
       <td class="titre">Nom de l'entreprise</td>
       <td>
+        {if $job.tmp_name}{$job.tmp_name} <small>(en cours de validation)</small>{else}
         <input type="text" class="enterprise_name {if $job.name_error}error{/if}" size="35" maxlength="100"
                name="{$jobpref}[name]" value="{$job.name}" />
+        {/if}
+      </td>
+    </tr>
+    {if !$job.tmp_name}
+    <tr class="{$entreprise}">
+      <td class="center" colspan="2">
+        <small>Si ton entreprise ne figure pas dans la liste,
+        <a href="javascript:addEntreprise({$i})">clique ici</a> et complète les informations la concernant.</small>
+      </td>
+    </tr>
+    {/if}
+    <tr class="{$entreprise}" style="display: none">
+      <td class="titre">Acronyme</td>
+      <td>
+        <input type="text" size="35" maxlength="255" {if $job.acronym_error}class="error"{/if}
+               name="{$jobpref}[acronym]" value="{$job.acronym}" />
+      </td>
+    </tr>
+    <tr class="{$entreprise}" style="display: none">
+      <td class="titre">Page Web</td>
+      <td>
+        <input type="text" size="35" maxlength="255" {if $job.hq_web_error}class="error"{/if}
+               name="{$jobpref}[hq_web]" value="{$job.hq_web}" />
+      </td>
+    </tr>
+    <tr class="{$entreprise}" style="display: none">
+      <td class="titre">Email de contact</td>
+      <td>
+        <input type="text" maxlength="60" {if $job.hq_email_error}class="error"{/if}
+               name="{$jobpref}[hq_email]" value="{$job.hq_email}" />
+      </td>
+    </tr>
+    <!--<tr class="{$entreprise}" style="display: none">
+      <td colspan="2">
+        <div style="float: left">
+          <div class="titre">Adresse du siège</div>
+          <div style="margin-top: 20px; clear: both">
+            {include file="geoloc/form.address.tpl" name="`$jobpref`[hq_adr]" id="`$jobid`_adr" adr=$job.hq_adr}
+          </div>
+        </div>
+      </td>
+    </tr>-->
+    <tr class="{$entreprise}" style="display: none">
+      <td class="titre">Téléphone</td>
+      <td>
+        <input type="text" maxlength="28" {if $job.hq_tel_error}class="error"{/if}
+               name="{$jobpref}[hq_tel]" value="{$job.hq_tel}" />
+      </td>
+    </tr>
+    <tr class="{$entreprise}" style="display: none">
+      <td class="titre">Fax</td>
+      <td>
+        <input type="text" maxlength="28" {if $job.hq_fax_error}class="error"{/if}
+               name="{$jobpref}[hq_fax]" value="{$job.hq_fax}" />
       </td>
     </tr>
 
     <tr class="pair">
       <td colspan="2" class="center" style="font-style: italic">Ta place dans l'entreprise</td>
     </tr>
-    <tr class="pair sector_text">
+    <tr class="pair {$sector_text}">
       <td class="titre">Secteur d'activité</td>
       <td>
         <input type="text" class="sector_name {if $job.sector_error}error{/if}" size="35" maxlength="100"
                name="{$jobpref}[sss_secteur_name]" value="{$job.sss_secteur_name}" />
-        <a href="javascript:displayAllSector()">{icon name="table" title="Tous les secteurs"}</a>
+        <a href="javascript:displayAllSector({$i})">{icon name="table" title="Tous les secteurs"}</a>
       </td>
     </tr>
-    <tr class="pair sector" style="display: none">
+    <tr class="pair {$sector}" style="display: none">
       <td class="titre" rowspan="3">Secteur d'activité</td>
       <td>
         <select name="{$jobpref}[secteur]" onchange="updateJobSecteur({$i}, '{$jobid}', '{$jobpref}', ''); return true;">
         </select>
       </td>
     </tr>
-    <tr class="pair sector" style="display: none">
+    <tr class="pair {$sector}" style="display: none">
       <td id="{$jobid}_ss_secteur">
         <input type="hidden" name="{$jobpref}[ss_secteur]" value="{$job.ss_secteur|default:'-1'}" />
       </td>
     </tr>
-    <tr class="pair sector" style="display: none">
+    <tr class="pair {$sector}" style="display: none">
       <td id="{$jobid}_sss_secteur">
         <input type="hidden" name="{$jobpref}[sss_secteur]" value="{$job.sss_secteur|default:'-1'}" />
       </td>
index 0830cee..8505fb8 100644 (file)
@@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS profile_job_enum (
   name VARCHAR(255) NOT NULL DEFAULT '',
   acronym VARCHAR(255) NOT NULL DEFAULT '',
   url VARCHAR(255) NOT NULL DEFAULT '',
+  email VARCHAR(255) NOT NULL DEFAULT '',
   holdingid INT(6) UNSIGNED DEFAULT NULL,
   NAF_code CHAR(5) NOT NULL DEFAULT '',
   AX_code BIGINT(10) UNSIGNED NOT NULL,
index 9ed21a6..f659ddb 100644 (file)
@@ -84,4 +84,7 @@ ALTER TABLE profile_job_sector_enum DROP COLUMN sect;
 ALTER TABLE profile_job_subsector_enum DROP COLUMN sect;
 ALTER TABLE profile_job_subsector_enum DROP COLUMN subsector;
 
+
+ALTER TABLE profile_phones CHANGE COLUMN link_type link_type ENUM('address','pro','user', 'hq') NOT NULL DEFAULT 'user';
+
 -- vim:set syntax=mysql: