diff --git a/htdocs/public/adherents/new.php b/htdocs/public/adherents/new.php new file mode 100644 index 00000000000..8b405ec2b82 --- /dev/null +++ b/htdocs/public/adherents/new.php @@ -0,0 +1,181 @@ + + * 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("../../adherent.class.php"); +require("../../adherent_type.class.php"); +require("../../cotisation.class.php"); +require("../../paiement.class.php"); + + +$db = new 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) && $nais !=''){ + if (!ereg("^\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"]; + + 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 + $mesg="Merci de votre inscription. Votre adhesion devrait etre rapidement validee.\nVoici le rappel des coordonnees que vous avez rentrees (toute information erronee entrainera la non validation de votre inscription) :\n\nPrenom : $prenom\nNom : $nom\nSociete = $societe\nAdresse = $adresse\nCode Postal : $cp\nVille : $ville\nPays : $pays\nEmail : $email\nLogin : $login\nPassword : $pass\nNote : $note\n\nVous pouvez a tout moment, grace a votre login et mot de passe, modifier vos coordonnees a l'adresse suivante :\nhttp://$SERVER_NAME/adherents/private/edit.php\n\n"; + mail($email,"Votre adhesion sur http://$SERVER_NAME/",$mesg); + Header("Location: new.php?action=added"); + } + } +} + +llxHeader(); + + +/* ************************************************************************** */ +/* */ +/* Création d'une fiche */ +/* */ +/* ************************************************************************** */ + + +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 ''; + +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 ?
\n"; + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/public/adherents/pre.inc.php b/htdocs/public/adherents/pre.inc.php new file mode 100644 index 00000000000..dde2d864a93 --- /dev/null +++ b/htdocs/public/adherents/pre.inc.php @@ -0,0 +1,63 @@ + + * + * 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("../../main.inc.php3"); + +function llxHeader($head = "") { + global $user, $conf; + + + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + $menu->add("new.php","Nouvel adherent"); + /* + $menu->add_submenu("liste.php?statut=1","Adhérents à ce jour"); + $menu->add_submenu("liste.php?statut=-1","Adhésions à valider"); + + $menu->add_submenu("liste.php?statut=0","Adhésions résiliées"); + + if ($user->admin) + { + $menu->add("fiche.php?action=create","Nouvel adhérent"); + } + + + + $menu->add("cotisations.php","Cotisations"); + + if ($user->admin) + { + $menu->add("type.php","Configuration"); + } + left_menu($menu->liste); + */ + // remplacement de la barre de gauche + print ''; + +} + +?>