return;
return geoloc_country($params['country']);
}
-$page->register_function('geoloc_country', '_geoloc_country_smarty');
+$GLOBALS['page']->register_function('geoloc_country', '_geoloc_country_smarty');
/** donne la liste deroulante des regions pour un pays
* @param $pays le pays dont on veut afficher les regions
return;
return geoloc_region($params['country'], $params['region']);
}
-$page->register_function('geoloc_region', '_geoloc_region_smarty');
+$GLOBALS['page']->register_function('geoloc_region', '_geoloc_region_smarty');
// }}}
// {{{ get_address_infos($txt)
global $globals;
if ($infos['sql'])
$globals->xdb->execute("REPLACE INTO geoloc_city VALUES ".$infos['sql']);
+ if ($infos['display'])
+ $globals->xdb->execute("UPDATE geoloc_pays SET display = {?} WHERE a2 = {?}", $infos['display'], $infos['country']);
return $infos;
}
// }}}
if ($adr['adr2']) $t.= "\n".$adr['adr2'];
if ($adr['adr3']) $t.= "\n".$adr['adr3'];
$l = "";
- if ($adr['country'] == 'US' || $adr['country'] == 'CA') {
- if ($adr['city']) $l .= $adr['city'].",\n";
- if ($adr['region']) $l .= $adr['region']." ";
- if ($adr['postcode']) $l .= $adr['postcode'];
- } else {
- if ($adr['postcode']) $l .= $adr['postcode']." ";
- if ($adr['city']) $l .= $adr['city'];
+ if ($adr['display']) {
+ $keys = explode(' ', $adr['display']);
+ foreach ($keys as $key) {
+ if (isset($adr[$key]))
+ $l .= " ".$adr[$key];
+ else
+ $l .= " ".$key;
+ }
+ if ($l) $l = substr($l, 1);
+ }
+ else
+ {
+ if ($adr['country'] == 'US' || $adr['country'] == 'CA' || $adr['country'] == 'GB') {
+ if ($adr['city']) $l .= $adr['city'].",\n";
+ if ($adr['region']) $l .= $adr['region']." ";
+ if ($adr['postcode']) $l .= $adr['postcode'];
+ } else {
+ if ($adr['postcode']) $l .= $adr['postcode']." ";
+ if ($adr['city']) $l .= $adr['city'];
+ }
}
if ($l) $t .= "\n".trim($l);
if ($adr['country'] != '00' && (!$adr['countrytxt'] || $adr['countrytxt'] == strtoupper($adr['countrytxt']))) {
"city" => "",
"postcode" => "",
"region" => "",
+ "regiontxt" => "",
"country" => "00",
"countrytxt" => "");
}
$globals->xdb->execute("UPDATE adresses SET
adr1 = {?}, adr2 = {?}, adr3 = {?},
cityid = {?}, city = {?}, postcode = {?},
- region = {?}, country = {?}
+ region = {?}, regiontxt = {?}, country = {?}
WHERE uid = {?} AND adrid = {?}",
$new['adr1'], $new['adr2'], $new['adr3'],
$new['cityid'], $new['city'], $new['postcode'],
- $new['region'], $new['country'],
+ $new['region'], $new['regiontxt'], $new['country'],
$uid, $a['adrid']);
$new['store'] = true;
if (!$new['cityid']) $erreur[$a['adrid']] = $new;