';
+
print '';
print '';
diff --git a/htdocs/public/adherents/index.php b/htdocs/public/adherents/index.php
index 83c297e6010..68158747d9a 100644
--- a/htdocs/public/adherents/index.php
+++ b/htdocs/public/adherents/index.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2006 Laurent Destailleur
+ * Copyright (C) 2006-2007 Laurent Destailleur
*
* 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
diff --git a/htdocs/public/adherents/new.php b/htdocs/public/adherents/new.php
index 61410858753..af1bafd1128 100644
--- a/htdocs/public/adherents/new.php
+++ b/htdocs/public/adherents/new.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville
* Copyright (C) 2001-2002 Jean-Louis Bergamo
* Copyright (C) 2006-2007 Laurent Destailleur
+ *
* 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
@@ -28,9 +29,9 @@
*/
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");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
$adho = new AdherentOptions($db);
$errmsg='';
diff --git a/htdocs/public/adherents/priv_edit.php b/htdocs/public/adherents/priv_edit.php
index e3e6fcfc5dd..58768aee803 100644
--- a/htdocs/public/adherents/priv_edit.php
+++ b/htdocs/public/adherents/priv_edit.php
@@ -1,6 +1,7 @@
* Copyright (C) 2001-2002 Jean-Louis Bergamo
+ * Copyright (C) 2007 Laurent Destailleur
*
* 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
@@ -20,234 +21,255 @@
* $Source$
*/
+/**
+ \file htdocs/public/adherents/priv_edit.php
+ \ingroup adherent
+ \brief Page edition de sa fiche adherent
+ \version $Revision$
+*/
+
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");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
$adho = new AdherentOptions($db);
+$langs->load("companies");
+$langs->load("main");
+$langs->load("other");
+$langs->load("users");
+
$errmsg='';
$num=0;
$error=0;
+
+
/*
- * Enregistrer les modifs
+ * Actions
*/
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
+ 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");
+ // 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");
}
- }
- }
- else
- {
- //Header("Location: fiche.php?rowid=$rowid&action=edit");
- Header("Location: priv_edit.php");
- }
}
llxHeaderVierge();
-if (isset($user->login))
+if (isset($_GET["id"]))
{
+ $adh = new Adherent($db);
+ $result=$adh->fetch($_GET["id"]);
+ $adh->fetch_optionals($adh->id);
+ // fetch optionals attibutes
+ $adho->fetch_optionals();
- $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);
- $adht = new AdherentType($db);
+ print_titre("Edition de la fiche adhérent de $adh->prenom $adh->nom");
- print_titre("Edition de la fiche adhérent de $adh->prenom $adh->nom");
+ if ($errmsg != ''){
+ print '
';
+
+ print '
Erreur dans le formulaire
';
+ print "
$errmsg
\n";
+ // print "$errmsg\n";
+ print '
';
+ }
- if ($errmsg != ''){
- print '
';
-
- print '
Erreur dans le formulaire
';
- print "
$errmsg
\n";
- // print "$errmsg\n";
- print '
';
- }
+ // Formulaire modifications
+ print '';
}
$db->close();
diff --git a/htdocs/public/adherents/priv_fiche.php b/htdocs/public/adherents/priv_fiche.php
index 10a73e5f5f8..3b68b36bb7a 100644
--- a/htdocs/public/adherents/priv_fiche.php
+++ b/htdocs/public/adherents/priv_fiche.php
@@ -1,6 +1,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo
+ * Copyright (C) 2007 Laurent Destailleur
*
* 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
@@ -18,14 +19,14 @@
*
* $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/cotisation.class.php");
-require(DOL_DOCUMENT_ROOT."/paiement.class.php");
-require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
+require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
$adho = new AdherentOptions($db);
diff --git a/htdocs/public/adherents/priv_liste.php b/htdocs/public/adherents/priv_liste.php
index f1970248c01..103c9f15c65 100644
--- a/htdocs/public/adherents/priv_liste.php
+++ b/htdocs/public/adherents/priv_liste.php
@@ -1,7 +1,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo
- * Copyright (C) 2004-2006 Laurent Destailleur
+ * Copyright (C) 2004-2007 Laurent Destailleur
*
* 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