From a6dcf7ed6e2ca2c8f39eda6008c24b9ecd0da3bd Mon Sep 17 00:00:00 2001 From: Thomas Minvielle Date: Sat, 8 Mar 2014 15:42:24 +0100 Subject: [PATCH] Add a SIREN field to profile_jobs_enum. --- include/validations/entreprises.inc.php | 9 +++++---- modules/admin.php | 5 +++-- templates/admin/jobs.tpl | 4 ++++ templates/include/form.valid.edit-entreprises.tpl | 2 ++ templates/include/form.valid.entreprises.tpl | 4 ++++ upgrade/1.1.12/07_create_SIREN.sql | 1 + 6 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 upgrade/1.1.12/07_create_SIREN.sql diff --git a/include/validations/entreprises.inc.php b/include/validations/entreprises.inc.php index 06af35b..42e1f4a 100644 --- a/include/validations/entreprises.inc.php +++ b/include/validations/entreprises.inc.php @@ -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, diff --git a/modules/admin.php b/modules/admin.php index 347e66e..a541100 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -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 diff --git a/templates/admin/jobs.tpl b/templates/admin/jobs.tpl index 4e9ddb3..9f10c45 100644 --- a/templates/admin/jobs.tpl +++ b/templates/admin/jobs.tpl @@ -57,6 +57,10 @@ + Code SIREN + + + Code NAF diff --git a/templates/include/form.valid.edit-entreprises.tpl b/templates/include/form.valid.edit-entreprises.tpl index af700b7..f11d1b2 100644 --- a/templates/include/form.valid.edit-entreprises.tpl +++ b/templates/include/form.valid.edit-entreprises.tpl @@ -30,6 +30,8 @@
Holding :
+Code SIREN : +
Code NAF :
Code AX : diff --git a/templates/include/form.valid.entreprises.tpl b/templates/include/form.valid.entreprises.tpl index 31dfa94..f6929b5 100644 --- a/templates/include/form.valid.entreprises.tpl +++ b/templates/include/form.valid.entreprises.tpl @@ -63,6 +63,10 @@ {$valid->holdingid} + Code SIREN : + {$valid->SIREN} + + Code NAF : {$valid->NAF_code} diff --git a/upgrade/1.1.12/07_create_SIREN.sql b/upgrade/1.1.12/07_create_SIREN.sql new file mode 100644 index 0000000..c5afc14 --- /dev/null +++ b/upgrade/1.1.12/07_create_SIREN.sql @@ -0,0 +1 @@ +ALTER TABLE profile_job_enum ADD SIREN_code CHAR(9) NULL DEFAULT NULL AFTER holdingid; -- 2.1.4