X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Faddresses.inc.php;h=2fe7a8d4c08749f6c3039cb5ed1affe8034aaaa5;hb=660ca64ac15ba544868e52f89a4c16f270eee107;hp=9c4aec979d85b961cc1ab2b55d76ba63abee7510;hpb=7c2e0f0db1940d4d52d282ddd06d22706ee35a54;p=platal.git diff --git a/modules/profile/addresses.inc.php b/modules/profile/addresses.inc.php index 9c4aec9..2fe7a8d 100644 --- a/modules/profile/addresses.inc.php +++ b/modules/profile/addresses.inc.php @@ -1,6 +1,6 @@ &$adr) { if (@$adr['current']) { $current++; } } - if (!$init && $current != 1 && count($value) > 0) { + if ($current == 0 && count($value) > 0) { + foreach ($value as $key=>&$adr) { + $adr['current'] = true; + break; + } + } else if ($current > 1) { $success = false; - } else { - $success = true; } foreach ($value as $key=>&$adr) { $ls = true; @@ -134,17 +138,17 @@ class ProfileAddress extends ProfileGeoloc postcode, city, cityid, country, region, regiontxt, pub, datemaj, statut, - uid, adrid) + uid, adrid, glat, glng) VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, FROM_UNIXTIME({?}), {?}, - {?}, {?})", + {?}, {?}, {?}, {?})", $address['adr1'], $address['adr2'], $address['adr3'], $address['postcode'], $address['city'], $address['cityid'], $address['country'], $address['region'], $address['regiontxt'], $address['pub'], $address['datemaj'], $flags, - S::i('uid'), $adrid); + S::i('uid'), $adrid, $address['precise_lat'], $address['precise_lon']); foreach ($address['tel'] as $telid=>&$tel) { $this->saveTel($adrid, $telid, $tel); } @@ -172,6 +176,7 @@ class ProfileAddresses extends ProfilePage { parent::__construct($wiz); $this->settings['addresses'] = new ProfileAddress(); + $this->watched['addresses'] = true; } protected function _fetchData() @@ -185,7 +190,8 @@ class ProfileAddresses extends ProfilePage FIND_IN_SET('res-secondaire', a.statut) AS secondaire, FIND_IN_SET('courrier', a.statut) AS mail, FIND_IN_SET('temporaire', a.statut) AS temporary, - FIND_IN_SET('active', a.statut) AS current + FIND_IN_SET('active', a.statut) AS current, + a.glat AS precise_lat, a.glng AS precise_lon FROM adresses AS a INNER JOIN geoloc_pays AS gp ON(gp.a2 = a.country) WHERE uid = {?} AND NOT FIND_IN_SET('pro', statut)