Geoloc and other fixes
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 8 Sep 2007 23:52:02 +0000 (01:52 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 8 Sep 2007 23:52:02 +0000 (01:52 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
modules/profile.php
modules/profile/jobs.inc.php
modules/profile/page.inc.php
templates/geoloc/form.address.tpl
templates/profile/adresses.tpl
templates/profile/jobs.tpl

index ccbd047..40ef129 100644 (file)
@@ -380,6 +380,11 @@ class ProfileModule extends PLModule
         $page->assign('job', array());
         $page->assign('ajaxjob', true);
         $page->assign('new', true);
+        $page->assign('secteurs', XDB::iterator("SELECT  id, label
+                                                   FROM  emploi_secteur"));
+        $page->assign('fonctions', XDB::iterator("SELECT  id, fonction_fr, FIND_IN_SET('titre', flags) AS title
+                                                    FROM  fonctions_def
+                                                ORDER BY  id"));
     }
 
     function handler_ajax_secteur(&$page, $id, $sect, $ssect = -1)
index b81c8f9..c544ef9 100644 (file)
@@ -68,7 +68,7 @@ class ProfileJob extends ProfileGeoloc
         }
         $success = true;
         foreach ($value as $key=>&$job) {
-            if (@$job['removed']) {
+            if (@$job['removed'] || !trim($job['name'])) {
                 unset($value[$key]);
             }
         }
index 411be43..1afcd9f 100644 (file)
@@ -138,9 +138,11 @@ abstract class ProfileGeoloc implements ProfileSetting
             || (@$address['text'] && !@$address['cityid'])) {
             $address = array_merge($address, empty_address());
             $new = get_address_infos(@$address['text']);
-            if (compare_addresses_text(@$adress['text'], $geotxt = get_address_text($new))
-                || @$address['parsevalid']) {
+            if (compare_addresses_text(@$address['text'], $geotxt = get_address_text($new))
+                || (@$address['parsevalid'] && @$address['cityid'])) {
                 $address = array_merge($address, $new);
+            } else if (@$address['parsevalid']) {
+                $address = array_merge($address, cut_address(@$address['text']));
             } else {
                 $success = false;
                 $address = array_merge($address, cut_address(@$address['text']));
index 3b4f87d..428cc6e 100644 (file)
@@ -40,6 +40,7 @@
           name="{$name}[geoloc]"
           onclick="blur()"
           >{$adr.geoloc}</textarea>
+<input type="hidden" name="{$name}[geoloc_cityid]" value="{$adr.geoloc_cityid}" />
 <input type="hidden" name="{$name}[parsevalid]" value="0" />
 </span>
 </div>
index f87b691..9d6f176 100644 (file)
@@ -124,7 +124,7 @@ function validAddress(id, pref)
   document.getElementById(id + '_geoloc').style.display = 'none';
   document.getElementById(id + '_geoloc_error').style.display = 'none';
   document.getElementById(id + '_geoloc_valid').style.display = 'none';
-  document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
+  document.forms.prof_annu[pref + "[parsevalid]"].value = "0";
   attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
               function() { document.forms.prof_annu[pref + "[text]"].blur(); });
   document.forms.prof_annu[pref + "[text]"].className = '';
index 46fe55c..e42a14a 100644 (file)
@@ -75,6 +75,7 @@ function validGeoloc(id, pref)
   document.getElementById(id + '_geoloc_valid').style.display = 'none';
   document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
   document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value;
+  document.forms.prof_annu[pref + "[cityid]"].value = document.forms.prof_annu[pref + "[geoloc_cityid]"].value;
   attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
               function() { document.forms.prof_annu[pref + "[text]"].blur(); });
   document.forms.prof_annu[pref + "[text]"].className = '';