* Profile:
- #385: Add section, binets and groupes-X in vCard. -FRU
- #451: vCard are RFC compliant. -FRU
+ - #466: Fix delete phone number. -Car
- #502: Use 'alias' instead of 'aka' to specify the nickname. -FRU
- #536: Can use login.promo as a valid user identifier. -FRU
- #539: Medals and deco need validation from admin. -Car
}
}
}
- if ($infos['sql'])
+ if (isset($infos['sql']) && $infos['sql'])
XDB::execute("REPLACE INTO geoloc_city VALUES ".$infos['sql']);
- if ($infos['display'])
+ if (isset($infos['display']) && $infos['display'])
XDB::execute("UPDATE geoloc_pays SET display = {?} WHERE a2 = {?}", $infos['display'], $infos['country']);
- fix_cities_not_on_map(1, $infos['cityid']);
+ if (isset($infos['cityid']))
+ fix_cities_not_on_map(1, $infos['cityid']);
return $infos;
}
// }}}
*/
function get_address_text($adr) {
$t = "";
- if ($adr['adr1']) $t.= $adr['adr1'];
- if ($adr['adr2']) $t.= "\n".$adr['adr2'];
- if ($adr['adr3']) $t.= "\n".$adr['adr3'];
+ if (isset($adr['adr1']) && $adr['adr1']) $t.= $adr['adr1'];
+ if (isset($adr['adr2']) && $adr['adr2']) $t.= "\n".$adr['adr2'];
+ if (isset($adr['adr3']) && $adr['adr3']) $t.= "\n".$adr['adr3'];
$l = "";
- if ($adr['display']) {
+ if (isset($adr['display']) && $adr['display']) {
$keys = explode(' ', $adr['display']);
foreach ($keys as $key) {
if (isset($adr[$key]))
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 (isset($adr['postcode']) && $adr['postcode']) $l .= $adr['postcode']." ";
+ if (isset($adr['city']) && $adr['city']) $l .= $adr['city'];
}
}
if ($l) $t .= "\n".trim($l);
$res = XDB::query("SELECT pays FROM geoloc_pays WHERE a2 = {?}", $adr['country']);
$adr['countrytxt'] = $res->fetchOneCell();
}
- if ($adr['countrytxt']) $t .= "\n".$adr['countrytxt'];
+ if (isset($adr['countrytxt']) && $adr['countrytxt']) $t .= "\n".$adr['countrytxt'];
return trim($t);
}
// }}}
reset($adresses);
//on génère un éventuel nouveau tel pour chaque adresse
foreach($adresses as $adrid => $adr){
- if (!isset($adr['tels'])) {
+ if (!isset($adr['tels']) || count($adr['tels']) == 0) {
$adresses[$adrid]['tels'] = array(
array('tel' => '', 'tel_pub' => 'private', 'tel_type' => 'Tél.', 'telid' => 0, 'new_tel' => true),
array('tel' => '', 'tel_pub' => 'private', 'tel_type' => 'Fax', 'telid' => 1, 'new_tel' => true));
require_once('geoloc.inc.php');
-global $adresses;
+global $adresses, $nb_adr_max, $nb_tel_max;
// on limite à 6 adresses personnelles par utilisateur
$nb_adr_max = 6; // ( = max(adrid possibles)
function is_adr_empty($adrid){
$adr = &$GLOBALS['adresses'][$adrid];
+ $emptytel = count($adr['tels']) == 0;
+ if (!$emptytel) {
+ $emptytel = true;
+ foreach ($adr['tels'] as $t) if ($t['tel']) {
+ $emptytel = false;
+ break;
+ }
+ }
return (
($adr['adr1'] == '') && ($adr['adr2'] == '') && ($adr['adr3'] == '') &&
($adr['postcode'] == '') && ($adr['city'] == '') && ($adr['country'] == '00') &&
- (count($adr['tels']) == 0)
+ ($emptytel)
);
}
delete_address($i,true);
}
}
+if (Env::i('deltel')) {
+ XDB::execute("DELETE FROM tels WHERE uid = {?} AND adrid = {?} AND telid = {?}",
+ S::v('uid', -1), Env::i('adrid'), Env::i('telid'));
+}
//$sql_order = "ORDER BY (NOT FIND_IN_SET('active', statut)), FIND_IN_SET('temporaire', statut)";
$sql_order = '';
function insert_new_tel($adrid, $tel) {
if ($tel['tel'] == "")
return;
+ $r = XDB::query("SELECT MAX(telid+1) FROM tels WHERE uid = {?} AND adrid = {?}", S::v('uid',-1), $adrid);
+ $newid = $r->fetchOneCell();
+ if (!$newid) $newid = 0;
XDB::execute( "INSERT INTO tels SET tel_type = {?}, tel_pub = {?},
tel = {?}, uid = {?}, adrid = {?}, telid = {?}",
$tel['tel_type'], $tel['tel_pub'], $tel['tel'],
- S::v('uid', -1), $adrid, $tel['telid']);
+ S::v('uid', -1), $adrid, $newid);
}
foreach ($adresses as $adrid => $adr) {
-
if ($adr['nouvelle'] != 'new') {
// test si on vient de creer cette adresse dans verif_adresse.inc.php
if ($adr["nouvelle"] == 'ajout') {
//nouvelle adresse
+ if (is_adr_empty($adrid)) {
+ unset($adresses[$adrid]);
+ continue;
+ }
+ echo "Nouveau pas vide";
XDB::execute("INSERT INTO adresses SET adr1 = {?}, adr2 = {?},
adr3 = {?}, postcode = {?}, city = {?}, cityid = {?},
country = {?}, region = {?}, regiontxt = {?},
$adr['region'], $adr['regiontxt'], $adr['pub'],
$statut, S::v('uid', -1), $adrid);
foreach ($adr['tels'] as $tel) {
- if ($tel['new_tel']) {
- insert_new_tel($adrid, $tel);
+ if (isset($tel['new_tel'])) {
+ if ($tel['new_tel'])
+ insert_new_tel($adrid, $tel);
} else {
if ($tel['tel'] != "") {
XDB::execute(
// mise a jour des champs relatifs au tab ouvert
require_once "profil/update_{$opened_tab}.inc.php";
- $log =& S::v('log');
+ $log =& $_SESSION['log'];
$log->log('profil', $opened_tab);
$page->assign('etat_update', 'ok');
}
<input type="hidden" name="numero_formulaire[{$adrid}]" value="{$smarty.section.i.index}" />
{/if}
{if $adr.nouvelle != 'new'}
- [<a href="profile/edit/{$onglet}?adrid_del[{$adrid}]=1" style="color:inherit">La supprimer !</a>]
+ <a href="profile/edit/{$onglet}?adrid_del[{$adrid}]=1" style="color:inherit">{icon name=cross title="Supprimer cette adresse"}</a>
{/if}
</th>
</tr>
<tr class="flags">
<td class="colg">
<input type="hidden" name="telid{$tel.telid}[{$adrid}]" value="{$tel.telid}"/>
- {if $tel.new_tel}
+ {if $tel.new_tel && !$tel.tel}
<input type="hidden" name="new_tel{$tel.telid}[{$adrid}]" value="1"/>
{/if}
<span class="titre" onclick="this.style.display='none';var d = document.getElementById('tel_type{$adrid}_{$tel.telid}');d.style.display='inline';d.select();d.focus();">{$tel.tel_type} :</span>
</td>
<td>
<input type="text" size="19" maxlength="28" name="tel{$tel.telid}[{$adrid}]" value="{$tel.tel}" />
+ {if $tel.tel}
+ <a href="profile/edit/{$onglet}?adrid={$adrid}&telid={$tel.telid}&deltel=1">{icon name=cross title="Supprimer ce tél."}</a>
+ {/if}
</td>
{include file="include/flags.radio.tpl" name="tel_pub`$tel.telid`[$adrid]" val=$tel.tel_pub display="mini"}
</tr>