2 /***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
24 function insert_new_tel($adrid, $tel) {
26 if ($tel['tel'] == "") return;
27 $globals->xdb
->execute(
38 Session
::getInt('uid', -1),
43 foreach($adresses as $adrid => $adr){
45 if($adr['nouvelle'] != 'new'){ // test si on vient de creer cette adresse dans verif_adresse.inc.php
47 //construction des bits
49 if ($adr["secondaire"]) $statut .= 'res-secondaire,';
50 if ($adr["courrier"]) $statut .= 'courrier,';
51 if ($adr["active"]) $statut .= 'active,';
52 if ($adr["temporaire"]) $statut .= 'temporaire,';
53 if (! empty($statut)) $statut = substr($statut, 0, -1);
55 if ($adr["nouvelle"] == 'ajout') {
57 $globals->xdb
->execute("INSERT INTO adresses SET
70 uid = {?}, adrid = {?}",
82 Session
::getInt('uid', -1), $adrid);
84 foreach ($adr['tels'] as $tel)
85 insert_new_tel($adrid, $tel);
89 //c'est une mise à jour
90 $globals->xdb
->execute(
104 WHERE uid = {?} AND adrid = {?}",
116 Session
::getInt('uid', -1), $adrid
118 foreach ($adr['tels'] as $tel) {
120 insert_new_tel($adrid, $tel);
122 if ($tel['tel'] != "") {
123 $globals->xdb
->execute(
135 Session
::getInt('uid', -1),
139 $globals->xdb
->execute(
140 "DELETE FROM tels WHERE
144 Session
::getInt('uid', -1),
149 }// fin nouvelle / ancienne adresse
150 }//fin if nouvellement crée