Fixes time saving and uses CRLF in address text because of RFC 1738.
[platal.git] / modules / profile / jobs.inc.php
index 1b67ff1..b098012 100644 (file)
@@ -120,7 +120,7 @@ class ProfileJob extends ProfileGeocoding
         $success = true;
         foreach ($value as $key=>&$job) {
             $job['name'] = trim($job['name']);
-            if (!$job['name']) {
+            if (!$job['name'] && $entreprise) {
                 $job['tmp_name'] = $entreprise[$entr_val]->name;
                 $entr_val ++;
             }
@@ -143,6 +143,8 @@ class ProfileJob extends ProfileGeocoding
 
     public function save(ProfilePage &$page, $field, $value)
     {
+        // TODO: use address and phone classes to update profile_job_enum and profile_phones once they are done.
+
         require_once('profil.func.inc.php');
         require_once('validations.inc.php');
 
@@ -156,7 +158,7 @@ class ProfileJob extends ProfileGeocoding
                             WHERE  uid = {?} AND link_type = 'pro'",
                      S::i('uid'));
         foreach ($value as $id=>&$job) {
-            if ($job['jobid']) {
+            if (isset($job['jobid']) && $job['jobid']) {
                 XDB::execute("INSERT INTO  profile_job (uid, id, description, sectorid, subsectorid,
                                                         subsubsectorid, email, url, pub, email_pub, jobid)
                                    VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
@@ -165,7 +167,7 @@ class ProfileJob extends ProfileGeocoding
             } else {
                 XDB::execute("INSERT INTO  profile_job (uid, id, description, sectorid, subsectorid,
                                                         subsubsectorid, email, url, pub, email_pub)
-                                   VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
+                                   VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
                              S::i('uid'), $id, $job['description'], $job['sector'], $job['subSector'],
                              $job['subSubSector'], $job['w_email'], $job['w_url'], $job['pub'], $job['w_email_pub']);
             }