* Copyright (C) 2001-2002 Jean-Louis Bergamo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ require("./pre.inc.php"); require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php"); $adho = new AdherentOptions($db); $errmsg=''; $num=0; $error=0; /* * Enregistrer les modifs */ if ($action == 'update') { if ($_POST["bouton"] == $langs->trans("Save")) { if (isset($user->login)){ $adh = new Adherent($db); $adh->fetch_login($user->login); if ($_POST["rowid"] == $adh->id){ // user and rowid is the same => good // test some values // test si le login existe deja $sql = "SELECT rowid,login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$user->login."';"; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); } if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom==''){ $error+=1; $errmsg .="Nom et Prenom obligatoires
\n"; } if (!isset($email) || $email == '' || !ereg('@',$email)){ $error+=1; $errmsg .="Adresse Email invalide
\n"; } if ($num !=0){ $obj=$db->fetch_object(0); if ($obj->rowid != $adh->id){ $error+=1; $errmsg .="Login deja utilise. Veuillez en changer
\n"; } } if (isset($naiss) && $naiss !=''){ if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$naiss)){ $error+=1; $errmsg .="Date de naissance invalide (Format AAAA-MM-JJ)
\n"; } } if (!$error){ // email a peu pres correct et le login n'existe pas $adh->id = $_POST["rowid"]; $adh->prenom = $prenom; $adh->nom = $nom; $adh->societe = $societe; $adh->adresse = $adresse; $adh->amount = $amount; $adh->cp = $cp; $adh->ville = $_POST["ville"]; $adh->email = $_POST["email"]; // interdiction de la modif du login adherent // $adh->login = $_POST["login"]; $adh->login = $adh->login; $adh->pass = $_POST["pass"]; $adh->naiss = $_POST["naiss"]; $adh->photo = $_POST["photo"]; $adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear); $adh->note = $_POST["note"]; $adh->pays = $_POST["pays"]; $adh->typeid = $_POST["type"]; $adh->commentaire = $_POST["comment"]; $adh->morphy = $_POST["morphy"]; // recuperation du statut et public $adh->statut = $_POST["statut"]; if (isset($public)){ $public=1; }else{ $public=0; } $adh->public = $public; foreach($_POST as $key => $value){ if (ereg("^options_",$key)){ $adh->array_options[$key]=$_POST[$key]; } } if ($adh->update($user->id) ) { $adh->send_an_email($email,$conf->adherent->email_edit,$conf->adherent->email_edit_subject); //Header("Location: fiche.php?rowid=$adh->id&action=edit"); Header("Location: priv_edit.php"); } } }else{ Header("Location: priv_edit.php"); } } } else { //Header("Location: fiche.php?rowid=$rowid&action=edit"); Header("Location: priv_edit.php"); } } llxHeaderVierge(); if (isset($user->login)) { $adh = new Adherent($db); $adh->login = $user->login; $adh->fetch_login($user->login); $adh->fetch_optionals($adh->id); // fetch optionals attibutes $adho->fetch_optionals(); $adht = new AdherentType($db); print_titre("Edition de la fiche adhérent de $adh->prenom $adh->nom"); if ($errmsg != ''){ print ''; print ''; print "\n"; // print "$errmsg\n"; print '
Erreur dans le formulaire
$errmsg
'; } print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if ($adh->public==1){ print ''; }else{ print ''; } foreach($adho->attribute_label as $key=>$value){ print "\n"; } print "
'.$langs->trans("Type").''.$adh->type.''.$langs->trans("Comments").'
Personne'.$adh->morphy.' '; print nl2br($adh->commentaire).' 
Prénom'.$adh->prenom.' 
Nom'.$adh->nom.' 
Société'.$adh->societe.' 
Adresse'.nl2br($adh->adresse).' 
CP Ville'.$adh->cp.' '.$adh->ville.' 
Pays'.$adh->pays.' 
Email'.$adh->email.' 
Login'.$adh->login.' 
Password'.$adh->pass.' 
Date de naissance
Format AAAA-MM-JJ
'.$adh->naiss.' 
URL Photo'.$adh->photo.' 
Profil public ? Oui
Profil public ? Non
$value".$adh->array_options["options_$key"]." 
\n"; print "
"; print "
"; print ''; print ""; print "id\">"; print "statut."\">"; print "login."\">"; // print "public."\">"; $htmls = new Form($db); print '"; print ''; $morphys["phy"] = "Physique"; $morphys["mor"] = "Morale"; print ""; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; // print ''; print ''; print ''; print ''; if ($adh->public==1){ print ''; }else{ print ''; } foreach($adho->attribute_label as $key=>$value){ print "\n"; } print ''; print ''; print '
'.$langs->trans("Type").''; $htmls->select_array("type", $adht->liste_array(), $adh->typeid); print "'.$langs->trans("Comments").'
Personne"; $htmls->select_array("morphy", $morphys, $adh->morphy); print "'; print '
Prénom
Nom
Societe
Adresse'; print '
CP Ville
Pays
Email
Login'.$adh->login.' 
Login
Password
Date de naissance
Format AAAA-MM-JJ
URL photo
Profil public ?
Profil public ?
$valuearray_options["options_$key"]."\">
'; print ' '; print ''; print '
'; } $db->close(); llxFooter('$Date$ - $Revision$'); ?>