X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fprofil%2Fupdate_adresses.inc.php;h=9783ebc37da8a9423362485bb4bc1b552af37c11;hb=17d6ca08e9f5e7bbad291d5fabfb2bc6da957381;hp=103a2c2837eda689ab0e2a674baa7d1754ab4d3e;hpb=c9970cbe14b30192a51dc38727254b332a1aec54;p=platal.git diff --git a/include/profil/update_adresses.inc.php b/include/profil/update_adresses.inc.php index 103a2c2..9783ebc 100644 --- a/include/profil/update_adresses.inc.php +++ b/include/profil/update_adresses.inc.php @@ -1,6 +1,6 @@ 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 @@ -51,6 +53,11 @@ foreach ($adresses as $adrid => $adr) { 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 = {?}, @@ -76,8 +83,9 @@ foreach ($adresses as $adrid => $adr) { $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(