diff --git a/htdocs/public/adherents/index.php b/htdocs/public/adherents/index.php
index 728ba8d3c5b..4e3f4d4e0b5 100644
--- a/htdocs/public/adherents/index.php
+++ b/htdocs/public/adherents/index.php
@@ -25,9 +25,14 @@ llxHeader();
$db = new Db();
-print_titre("Gestion des adherents");
+print_titre("Gestion des adhesions a l'association");
print '
';
+print '| Les menus ci-contre correspondent a: |
';
+print '| -Inscription : | Formulaires d\'inscription pour les non-adherents |
';
+print '| -Edition de sa fiche : | Permet d\'editer sa fiche d\'adherent |
';
+print '| -Liste des adherents : | Permet de voir la liste des adherents (reserve aux adherents) |
';
+/*
print '';
print "| Type | ";
print "Nb | ";
@@ -61,7 +66,6 @@ if ($result)
$db->free();
}
-
print "
";
print '";
+*/
-
+print '';
$db->close();
diff --git a/htdocs/public/adherents/new.php b/htdocs/public/adherents/new.php
index 8b405ec2b82..b6ef7dcfa4b 100644
--- a/htdocs/public/adherents/new.php
+++ b/htdocs/public/adherents/new.php
@@ -55,8 +55,8 @@ if ($HTTP_POST_VARS["action"] == 'add')
$error+=1;
$errmsg .="Password invalide
\n";
}
- if (isset($naiss) && $nais !=''){
- if (!ereg("^\d\d\d\d\-\d\d\-\d\d",$naiss)){
+ 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";
}
@@ -95,7 +95,8 @@ if ($HTTP_POST_VARS["action"] == 'add')
$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";
+ $mesg=preg_replace("/%INFO%/","Prenom : $prenom\nNom : $nom\nSociete = $societe\nAdresse = $adresse\nCode Postal : $cp\nVille : $ville\nPays : $pays\nEmail : $email\nLogin : $login\nPassword : $pass\nNote : $note",$conf->adherent->email_new);
+ //$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");
}
diff --git a/htdocs/public/adherents/pre.inc.php b/htdocs/public/adherents/pre.inc.php
index dde2d864a93..f77893d6066 100644
--- a/htdocs/public/adherents/pre.inc.php
+++ b/htdocs/public/adherents/pre.inc.php
@@ -33,7 +33,11 @@ function llxHeader($head = "") {
$menu = new Menu();
- $menu->add("new.php","Nouvel adherent");
+ $menu->add("","Non adherent");
+ $menu->add_submenu("new.php","Inscription");
+ $menu->add("","Adherents");
+ $menu->add_submenu("priv_edit.php","Edition de sa fiche");
+ $menu->add_submenu("priv_liste.php","Liste des adherents");
/*
$menu->add_submenu("liste.php?statut=1","Adhérents à ce jour");
$menu->add_submenu("liste.php?statut=-1","Adhésions à valider");
@@ -53,10 +57,11 @@ function llxHeader($head = "") {
{
$menu->add("type.php","Configuration");
}
- left_menu($menu->liste);
*/
+ left_menu($menu->liste);
+
// remplacement de la barre de gauche
- print '';
+ // print ' | ';
}
diff --git a/htdocs/public/adherents/priv_edit.php b/htdocs/public/adherents/priv_edit.php
index 211e1230582..dea319fed17 100644
--- a/htdocs/public/adherents/priv_edit.php
+++ b/htdocs/public/adherents/priv_edit.php
@@ -24,7 +24,9 @@ require("../../adherent.class.php");
require("../../adherent_type.class.php");
$db = new Db();
-
+$errmsg='';
+$num=0;
+$error=0;
/*
* Enregistrer les modifs
*/
@@ -34,53 +36,99 @@ if ($action == 'update')
if ($HTTP_POST_VARS["bouton"] == "Enregistrer")
{
+ if (isset($_SERVER["REMOTE_USER"])){
+ $adh = new Adherent($db);
+ $adh->fetch_login($_SERVER["REMOTE_USER"]);
+ if ($HTTP_POST_VARS["rowid"] == $adh->id){
+ // user and rowid is the same => good
- $adh = new Adherent($db);
-
- $adh->id = $HTTP_POST_VARS["rowid"];
- $adh->prenom = $prenom;
- $adh->nom = $nom;
- $adh->societe = $societe;
- $adh->adresse = $adresse;
- $adh->amount = $amount;
- $adh->cp = $cp;
- $adh->ville = $HTTP_POST_VARS["ville"];
- $adh->email = $HTTP_POST_VARS["email"];
- $adh->login = $HTTP_POST_VARS["login"];
- $adh->pass = $HTTP_POST_VARS["pass"];
- $adh->naiss = $HTTP_POST_VARS["naiss"];
- $adh->photo = $HTTP_POST_VARS["photo"];
- $adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
- $adh->note = $HTTP_POST_VARS["note"];
- $adh->pays = $HTTP_POST_VARS["pays"];
- $adh->typeid = $HTTP_POST_VARS["type"];
- $adh->commentaire = $HTTP_POST_VARS["comment"];
- $adh->morphy = $HTTP_POST_VARS["morphy"];
- // recuperation du statut et public
- $adh->statut = $HTTP_POST_VARS["statut"];
- $adh->public = $HTTP_POST_VARS["public"];
-
- if ($adh->update($user->id) )
- {
- Header("Location: fiche.php?rowid=$adh->id&action=edit");
+ // test some values
+ // test si le login existe deja
+ $sql = "SELECT rowid,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){
+ $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 = $HTTP_POST_VARS["rowid"];
+ $adh->prenom = $prenom;
+ $adh->nom = $nom;
+ $adh->societe = $societe;
+ $adh->adresse = $adresse;
+ $adh->amount = $amount;
+ $adh->cp = $cp;
+ $adh->ville = $HTTP_POST_VARS["ville"];
+ $adh->email = $HTTP_POST_VARS["email"];
+ $adh->login = $HTTP_POST_VARS["login"];
+ $adh->pass = $HTTP_POST_VARS["pass"];
+ $adh->naiss = $HTTP_POST_VARS["naiss"];
+ $adh->photo = $HTTP_POST_VARS["photo"];
+ $adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
+ $adh->note = $HTTP_POST_VARS["note"];
+ $adh->pays = $HTTP_POST_VARS["pays"];
+ $adh->typeid = $HTTP_POST_VARS["type"];
+ $adh->commentaire = $HTTP_POST_VARS["comment"];
+ $adh->morphy = $HTTP_POST_VARS["morphy"];
+ // recuperation du statut et public
+ $adh->statut = $HTTP_POST_VARS["statut"];
+ if (isset($public)){
+ $public=1;
+ }else{
+ $public=0;
+ }
+ $adh->public = $public;
+
+ if ($adh->update($user->id) )
+ {
+ $mesg=preg_replace("/%INFO%/","Prenom : $prenom\nNom : $nom\nSociete = $societe\nAdresse = $adresse\nCode Postal : $cp\nVille : $ville\nPays : $pays\nEmail : $email\nLogin : $login\nPassword : $pass\nNote : $note",$conf->adherent->email_edit);
+ mail($email,"Vos coordonnees sur http://$SERVER_NAME/",$mesg);
+
+ //Header("Location: fiche.php?rowid=$adh->id&action=edit");
+ Header("Location: $PHP_SELF");
+ }
+ }
+ }else{
+ Header("Location: $PHP_SELF");
}
+ }
}
else
{
- Header("Location: fiche.php?rowid=$rowid&action=edit");
+ //Header("Location: fiche.php?rowid=$rowid&action=edit");
+ Header("Location: $PHP_SELF");
}
}
llxHeader();
-
-if ($rowid)
-{
+if (isset($_SERVER["REMOTE_USER"])){
$adh = new Adherent($db);
- $adh->id = $rowid;
- $adh->fetch($rowid);
+ $adh->login = $_SERVER["REMOTE_USER"];
+ $adh->fetch_login($_SERVER["REMOTE_USER"]);
$sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber";
$sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp";
@@ -98,8 +146,16 @@ if ($rowid)
$adht = new AdherentType($db);
- print_titre("Edition de la fiche adhérent");
+ 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 ' ';
+ }
print '';
@@ -123,7 +179,11 @@ if ($rowid)
print '| Password | '.$adh->pass.' | ';
print 'Date de naissance Format AAAA-MM-JJ | '.$adh->naiss.' | ';
print '| URL Photo | '.$adh->photo.' | ';
-
+ if ($adh->public==1){
+ print '| Profil public ? | Oui | ';
+ }else{
+ print '| Profil public ? | Non | ';
+ }
print " \n";
print " ";
@@ -132,9 +192,9 @@ if ($rowid)
print '';
print "";
- print "";
+ print "id\">";
print "statut."\">";
- print "public."\">";
+ // print "public."\">";
$htmls = new Form($db);
@@ -170,6 +230,11 @@ if ($rowid)
print '| Password | | ';
print 'Date de naissance Format AAAA-MM-JJ | | ';
print '| URL photo | | ';
+ if ($adh->public==1){
+ print '| Profil public ? | | ';
+ }else{
+ print '| Profil public ? | | ';
+ }
print '| ';
print ' ';
print '';
diff --git a/htdocs/public/adherents/priv_liste.php b/htdocs/public/adherents/priv_liste.php
index 2ec429029f7..abf5568b388 100644
--- a/htdocs/public/adherents/priv_liste.php
+++ b/htdocs/public/adherents/priv_liste.php
@@ -26,8 +26,8 @@ llxHeader();
$db = new Db();
-if ($sortorder == "") { $sortorder="DESC"; }
-if ($sortfield == "") { $sortfield="d.nom"; }
+if ($sortorder == "") { $sortorder="ASC"; }
+if ($sortfield == "") { $sortfield="nom"; }
if ($page == -1) { $page = 0 ; }
@@ -35,16 +35,11 @@ $offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! isset($statut))
-{
- $statut = 1 ;
-}
-
-$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, ".$db->pdate("d.datefin")." as datefin";
-$sql .= " , d.email, t.libelle as type, d.morphy, d.statut, t.cotisation";
-$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
-$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut";
-$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
+$sql = "select rowid,prenom,nom, societe, cp,ville,email,naiss,photo from llx_adherent where statut=1 ORDER BY $sortfield $sortorder ". $db->plimit($conf->liste_limit, $offset);
+//$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, cp, ville, d.email, t.libelle as type, d.morphy, d.statut, t.cotisation";
+//$sql .= " FROM llx_adherent as d, llx_adherent_type as t";
+//$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut";
+//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
$result = $db->query($sql);
if ($result)
@@ -58,24 +53,25 @@ if ($result)
print ' | ';
- print "| Prenom Nom / Société | \n";
+ print "Prenom Nom / Société | \n";
print "";
- print_liste_field_titre("Date cotisation",$PHP_SELF,"t.cotisation","&page=$page&statut=$statut");
+ print_liste_field_titre("Date naissance",$PHP_SELF,"naiss","&page=$page");
print " | \n";
print "";
- print_liste_field_titre("Email",$PHP_SELF,"d.email","&page=$page&statut=$statut");
+ print_liste_field_titre("Email",$PHP_SELF,"email","&page=$page");
print " | \n";
print "";
- print_liste_field_titre("Type",$PHP_SELF,"t.libelle","&page=$page&statut=$statut");
+ print_liste_field_titre("CP",$PHP_SELF,"cp","&page=$page");
print " | \n";
+ print "";
+ print_liste_field_titre("Vile",$PHP_SELF,"ville","&page=$page");
+ print " | \n";
- print "Personne | \n";
- print "Statut | \n";
- print "Action | \n";
+ print "Photo | \n";
print " \n";
$var=True;
@@ -84,34 +80,16 @@ if ($result)
$objp = $db->fetch_object( $i);
$var=!$var;
print "";
- print "| rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)." | \n";
- print "";
- if ($objp->cotisation == 'yes')
- {
- if ($objp->datefin < time())
- {
- print "rowid&action=edit\">".strftime("%d %B %Y",$objp->datefin)." - Cotisation non recue | \n";
- }
- else
- {
- print "rowid&action=edit\">".strftime("%d %B %Y",$objp->datefin)."\n";
- }
- }
- else
- {
- print " ";
- }
-
+ print "rowid\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)." | \n";
+ print "$objp->naiss | \n";
print "$objp->email | \n";
- print "$objp->type | \n";
- print "$objp->morphy | \n";
- print "";
- if ($objp->statut == -1)
- {
- print 'A valider';
- }
- print " | ";
- print "rowid\">Editer rowid&action=resign\">Resilier rowid&action=delete\">Supprimer | \n";
+ print "$objp->cp | \n";
+ print "$objp->ville | \n";
+ if (isset($objp->photo) && $objp->photo!= ''){
+ print "photo\"> photo\" HEIGHT=64 WIDTH=64> | \n";
+ }else{
+ print " | \n";
+ }
print " ";
$i++;
}
|