Add a SIREN field to profile_jobs_enum.
authorThomas Minvielle <thomas.minvielle@polytechnique.org>
Sat, 8 Mar 2014 14:42:24 +0000 (15:42 +0100)
committerThomas Minvielle <thomas.minvielle@polytechnique.org>
Sat, 8 Mar 2014 14:42:47 +0000 (15:42 +0100)
include/validations/entreprises.inc.php
modules/admin.php
templates/admin/jobs.tpl
templates/include/form.valid.edit-entreprises.tpl
templates/include/form.valid.entreprises.tpl
upgrade/1.1.12/07_create_SIREN.sql [new file with mode: 0644]

index 06af35b..42e1f4a 100644 (file)
@@ -31,6 +31,7 @@ class EntrReq extends ProfileValidate
     public $url = null;
     public $email = null;
     public $holdingid = null;
+    public $SIREN = null;
     public $NAF_code = null;
     public $AX_code = null;
 
@@ -103,7 +104,7 @@ class EntrReq extends ProfileValidate
 
     protected function handle_editor()
     {
-        foreach (array('name', 'acronym', 'url', 'email', 'NAF_code', 'tel', 'fax', 'address') as $field) {
+        foreach (array('name', 'acronym', 'url', 'email', 'SIREN', 'NAF_code', 'tel', 'fax', 'address') as $field) {
             $this->$field = (Env::t($field) == '' ? null : Env::t($field));
         }
         foreach (array('AX_code', 'holdingid') as $field) {
@@ -143,10 +144,10 @@ class EntrReq extends ProfileValidate
                             WHERE  name = {?}',
                           $this->name);
         if ($res->numRows() != 1) {
-            XDB::execute('INSERT INTO  profile_job_enum (name, acronym, url, email, holdingid, NAF_code, AX_code)
-                               VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})',
+            XDB::execute('INSERT INTO  profile_job_enum (name, acronym, url, email, holdingid, SIREN_code, NAF_code, AX_code)
+                               VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
                          $this->name, $this->acronym, $this->url, $this->email,
-                         $this->holdingid, $this->NAF_code, $this->AX_code);
+                         $this->holdingid, $this->SIREN, $this->NAF_code, $this->AX_code);
 
             $jobid = XDB::insertId();
             $phone = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 0,
index 347e66e..a541100 100644 (file)
@@ -1808,9 +1808,10 @@ class AdminModule extends PLModule
             } else {
                 XDB::execute('UPDATE  profile_job_enum
                                  SET  name = {?}, acronym = {?}, url = {?}, email = {?},
-                                      NAF_code = {?}, AX_code = {?}, holdingid = {?}
+                                      SIREN_code = {?}, NAF_code = {?}, AX_code = {?}, holdingid = {?}
                                WHERE  id = {?}',
                              Env::t('name'), Env::t('acronym'), Env::t('url'), Env::t('email'),
+                             (Env::t('SIREN') == 0 ? null : Env::t('SIREN')),
                              (Env::t('NAF_code') == 0 ? null : Env::t('NAF_code')),
                              (Env::i('AX_code') == 0 ? null : Env::t('AX_code')),
                              (Env::i('holdingId') == 0 ? null : Env::t('holdingId')), $id);
@@ -1829,7 +1830,7 @@ class AdminModule extends PLModule
         }
 
         if (!Env::has('change') && $id != -1) {
-            $res = XDB::query("SELECT  e.id, e.name, e.acronym, e.url, e.email, e.NAF_code, e.AX_code,
+            $res = XDB::query("SELECT  e.id, e.name, e.acronym, e.url, e.email, e.SIREN_code AS SIREN, e.NAF_code, e.AX_code,
                                        h.id AS holdingId, h.name AS holdingName, h.acronym AS holdingAcronym,
                                        t.display_tel AS tel, f.display_tel AS fax, a.text AS address
                                  FROM  profile_job_enum  AS e
index 4e9ddb3..9f10c45 100644 (file)
       <td><input type="text" name="email" value="{$selectedJob.email}" /></td>
     </tr>
     <tr>
+      <td>Code SIREN</td>
+      <td><input type="text" name="SIREN" value="{$selectedJob.SIREN}" /></td>
+    </tr>
+    <tr>
       <td>Code NAF</td>
       <td><input type="text" name="NAF_code" value="{$selectedJob.NAF_code}" /></td>
     </tr>
index af700b7..f11d1b2 100644 (file)
@@ -30,6 +30,8 @@
 <input type="text" name="email" size="25" maxlength="255" value="{$valid->email}" /><br />
 <strong>Holding&nbsp;:</strong>
 <input type="text" name="holdingid" size="25" maxlength="200" value="{$valid->holdingid}" /><br />
+<strong>Code SIREN&nbsp;:</strong>
+<input type="text" name="SIREN" size="25" maxlength="200" value="{$valid->SIREN}" /><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>
index 31dfa94..f6929b5 100644 (file)
   <td>{$valid->holdingid}</td>
 </tr>
 <tr class="pair">
+  <td class="titre">Code SIREN&nbsp;:</td>
+  <td>{$valid->SIREN}</td>
+</tr>
+<tr class="pair">
   <td class="titre">Code NAF&nbsp;:</td>
   <td>{$valid->NAF_code}</td>
 </tr>
diff --git a/upgrade/1.1.12/07_create_SIREN.sql b/upgrade/1.1.12/07_create_SIREN.sql
new file mode 100644 (file)
index 0000000..c5afc14
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE profile_job_enum ADD SIREN_code CHAR(9) NULL DEFAULT NULL AFTER holdingid;