* 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($GLOBALS["DOCUMENT_ROOT"]."/adherent.class.php"); require($GLOBALS["DOCUMENT_ROOT"]."/adherent_type.class.php"); //require($GLOBALS["DOCUMENT_ROOT"]."/cotisation.class.php"); //require($GLOBALS["DOCUMENT_ROOT"]."/paiement.class.php"); require($GLOBALS["DOCUMENT_ROOT"]."/adherents/adherent_options.class.php"); $db = new Db(); $adho = new AdherentOptions($db); $errmsg=''; $num=0; $error=0; if ($HTTP_POST_VARS["action"] == 'add') { // test si le login existe deja $sql = "SELECT login FROM llx_adherent WHERE login='$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){ $error+=1; $errmsg .="Login deja utilise. Veuillez en changer
\n"; } if (!isset($pass1) || !isset($pass2) || $pass1 == '' || $pass2 == '' || $pass1!=$pass2){ $error+=1; $errmsg .="Password invalide
\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 (isset($public)){ $public=1; }else{ $public=0; } if (!$error){ // email a peu pres correct et le login n'existe pas $adh = new Adherent($db); $adh->statut = -1; $adh->public = $public; $adh->prenom = $prenom; $adh->nom = $nom; $adh->societe = $societe; $adh->adresse = $adresse; $adh->cp = $cp; $adh->ville = $ville; $adh->email = $email; $adh->login = $login; $adh->pass = $pass1; $adh->naiss = $naiss; $adh->photo = $photo; $adh->note = $note; $adh->pays = $pays; $adh->typeid = $type; $adh->commentaire = $HTTP_POST_VARS["comment"]; $adh->morphy = $HTTP_POST_VARS["morphy"]; foreach($_POST as $key => $value){ if (ereg("^options_",$key)){ $adh->array_options[$key]=$_POST[$key]; } } if ($adh->create($user->id) ) { if ($cotisation > 0) { $adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); } // Envoi d'un Email de confirmation au nouvel adherent $adh->send_an_email($email,$conf->adherent->email_new,$conf->adherent->email_new_subject); Header("Location: new.php?action=added"); } } } llxHeader(); /* ************************************************************************** */ /* */ /* Création d'une fiche */ /* */ /* ************************************************************************** */ // fetch optionals attributes and labels $adho->fetch_optionals(); if (isset($action) && $action== 'added'){ print ''; print "\n"; print '
Nouvel Adhérent ajouté. En attente de validation
'; } if ($errmsg != ''){ print ''; print ''; print "\n"; // print "$errmsg\n"; print '
Erreur dans le formulaire
$errmsg
'; } print_titre("Nouvel adhérent"); print '
\n"; print "
\n"; print ''; print ''; $htmls = new Form($db); $adht = new AdherentType($db); print '\n"; print ''; $morphys["phy"] = "Physique"; $morphys["mor"] = "Morale"; print "\n"; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; foreach($adho->attribute_label as $key=>$value){ print "\n"; } print ''; print "\n"; print "
Type'; $htmls->select_array("type", $adht->liste_array()); print "Commentaires :
Personne\n"; $htmls->select_array("morphy", $morphys); print "
* * Prénom
* * Nom
Societe
Adresse'; print '
CP Ville
Pays
* * Email
* Login
* Password (a entrer 2 fois)
Date de naissance
Format AAAA-MM-JJ
* URL Photo
Profil public ?
$value
\n"; $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>