Allows empty fields and fixes for entreprise validation.
authorStéphane Jacob <sj@m4x.org>
Sat, 3 Jul 2010 16:32:23 +0000 (18:32 +0200)
committerStéphane Jacob <sj@m4x.org>
Sat, 3 Jul 2010 16:49:48 +0000 (18:49 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
include/validations/entreprises.inc.php
templates/include/form.valid.edit-entreprises.tpl
templates/include/form.valid.entreprises.tpl
upgrade/1.0.1/00_job.sql [new file with mode: 0644]

index cff4801..bf60594 100644 (file)
@@ -98,26 +98,37 @@ class EntrReq extends ProfileValidate
 
     protected function handle_editor()
     {
-        if (Env::has('holdingid')) {
-            $this->holdingid = Env::t('holdingid');
-        }
         if (Env::has('name')) {
             $this->name = Env::t('name');
-            if (Env::has('acronym')) {
-                $this->acronym = Env::t('acronym');
-                if (Env::has('url')) {
-                    $this->url = Env::t('url');
-                    if (Env::has('NAF_code')) {
-                        $this->NAF_code = Env::t('NAF_code');
-                        if (Env::has('AX_code')) {
-                            $this->AX_code = Env::t('AX_code');
-                            return true;
-                        }
-                    }
-                }
-            }
         }
-        return false;
+        if (Env::has('acronym')) {
+            $this->acronym = Env::t('acronym');
+        }
+        if (Env::has('url')) {
+            $this->url = Env::t('url');
+        }
+        if (Env::has('email')) {
+            $this->email = Env::t('email');
+        }
+        if (Env::has('holdingid')) {
+            $this->holdingid = Env::i('holdingid');
+        }
+        if (Env::has('NAF_code')) {
+            $this->NAF_code = Env::t('NAF_code');
+        }
+        if (Env::has('AX_code')) {
+            $this->AX_code = Env::i('AX_code');
+        }
+        if (Env::has('address')) {
+            $this->address['text'] = Env::t('address');
+        }
+        if (Env::has('tel')) {
+            $this->tel = Env::t('tel');
+        }
+        if (Env::has('fax')) {
+            $this->fax = Env::t('fax');
+        }
+        return true;
     }
 
     // }}}
index 1fce6e7..7b59719 100644 (file)
@@ -27,7 +27,7 @@
 <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 />
+<input type="text" name="email" 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>
@@ -35,7 +35,7 @@
 <strong>Code AX&nbsp;:</strong>
 <input type="text" name="AX_code" size="25" maxlength="200" value="{$valid->AX_code}" /><br />
 <strong>Adresse&nbsp;:</strong>
-<textarea cols="30" rows="4" name="address">{$valid->address['text']}</textarea><br />
+<textarea cols="30" rows="4" name="address">{$valid->address.text}</textarea><br />
 <strong>Téléphone&nbsp;:</strong>
 <input type="text" name="tel" size="25" maxlength="200" value="{$valid->tel}" /><br />
 <strong>Fax&nbsp;:</strong>
index 58112e1..855ade8 100644 (file)
@@ -55,7 +55,7 @@
 </tr>
 <tr class="pair">
   <td class="titre">Adresse&nbsp;:</td>
-  <td>{$valid->address[text]}</td>
+  <td>{$valid->address.text}</td>
 </tr>
 <tr class="pair">
   <td class="titre">Téléphone&nbsp;:</td>
diff --git a/upgrade/1.0.1/00_job.sql b/upgrade/1.0.1/00_job.sql
new file mode 100644 (file)
index 0000000..4b6b5dd
--- /dev/null
@@ -0,0 +1,6 @@
+ALTER TABLE profile_job_enum MODIFY COLUMN acronym VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN url VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN email VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN NAF_code CHAR(5) DEFAULT NULL;
+
+-- vim:set syntax=mysql: