grosses modifs

This commit is contained in:
jlb 2003-02-03 11:35:39 +00:00
parent e49b8069e8
commit f16f87506a
5 changed files with 148 additions and 94 deletions

View File

@ -25,9 +25,14 @@ llxHeader();
$db = new Db();
print_titre("Gestion des adherents");
print_titre("Gestion des adhesions a l'association");
print '<p><TABLE border="0" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td colspan=2>Les menus ci-contre correspondent a:</td></tr>';
print '<tr><td>-Inscription :</td><td> Formulaires d\'inscription pour les non-adherents</td></tr>';
print '<tr><td>-Edition de sa fiche :</td><td> Permet d\'editer sa fiche d\'adherent</td></tr>';
print '<tr><td>-Liste des adherents :</td><td> Permet de voir la liste des adherents (reserve aux adherents)</td></tr>';
/*
print '<TR class="liste_titre">';
print "<td>Type</td>";
print "<td>Nb</td>";
@ -61,7 +66,6 @@ if ($result)
$db->free();
}
print "</table>";
print '<form action="liste.php" method="post" name="action" value="search">';
@ -78,9 +82,10 @@ print 'Nom/Pr
print '&nbsp; <input class="flat" type="submit" value="Chercher">';
print '</td></tr>';
print "</table></form>";
*/
print '</table>';
$db->close();

View File

@ -55,8 +55,8 @@ if ($HTTP_POST_VARS["action"] == 'add')
$error+=1;
$errmsg .="Password invalide<BR>\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)<BR>\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");
}

View File

@ -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 '</td><td valign="top" width="85%" colspan="6">';
// print '</td><td valign="top" width="85%" colspan="6">';
}

View File

@ -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<BR>\n";
}
if (!isset($email) || $email == '' || !ereg('@',$email)){
$error+=1;
$errmsg .="Adresse Email invalide<BR>\n";
}
if ($num !=0){
$obj=$db->fetch_object(0);
if ($obj->rowid != $adh->id){
$error+=1;
$errmsg .="Login deja utilise. Veuillez en changer<BR>\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)<BR>\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 '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print '<th>Erreur dans le formulaire</th>';
print "<tr><td class=\"delete\"><b>$errmsg</b></td></tr>\n";
// print "<FONT COLOR=\"red\">$errmsg</FONT>\n";
print '</table>';
}
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
@ -123,7 +179,11 @@ if ($rowid)
print '<tr><td>Password</td><td class="valeur">'.$adh->pass.'&nbsp;</td></tr>';
print '<tr><td>Date de naissance<BR>Format AAAA-MM-JJ</td><td class="valeur">'.$adh->naiss.'&nbsp;</td></tr>';
print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.'&nbsp;</td></tr>';
if ($adh->public==1){
print '<tr><td>Profil public ?</td><td> Oui </td></tr>';
}else{
print '<tr><td>Profil public ?</td><td> Non </td></tr>';
}
print "</table>\n";
print "<hr>";
@ -132,9 +192,9 @@ if ($rowid)
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
print "<input type=\"hidden\" name=\"rowid\" value=\"$adh->id\">";
print "<input type=\"hidden\" name=\"statut\" value=\"".$adh->statut."\">";
print "<input type=\"hidden\" name=\"public\" value=\"".$adh->public."\">";
// print "<input type=\"hidden\" name=\"public\" value=\"".$adh->public."\">";
$htmls = new Form($db);
@ -170,6 +230,11 @@ if ($rowid)
print '<tr><td>Password</td><td><input type="text" name="pass" size="40" value="'.$adh->pass.'"></td></tr>';
print '<tr><td>Date de naissance<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.$adh->naiss.'"></td></tr>';
print '<tr><td>URL photo</td><td><input type="text" name="photo" size="40" value="'.$adh->photo.'"></td></tr>';
if ($adh->public==1){
print '<tr><td>Profil public ?</td><td><input type="checkbox" name="public" checked></td></tr>';
}else{
print '<tr><td>Profil public ?</td><td><input type="checkbox" name="public"></td></tr>';
}
print '<tr><td colspan="2" align="center">';
print '<input type="submit" name="bouton" value="Enregistrer">&nbsp;';
print '<input type="submit" value="Annuler">';

View File

@ -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 '<TR class="liste_titre">';
print "<td><a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&statut=$statut&sortorder=ASC&sortfield=d.prenom\">Prenom</a> <a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&statut=$statut&sortorder=ASC&sortfield=d.nom\">Nom</a> / <a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&statut=$statut&sortorder=ASC&sortfield=d.societe\">Société</a></td>\n";
print "<td><a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&sortorder=ASC&sortfield=d.prenom\">Prenom</a> <a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&sortorder=ASC&sortfield=d.nom\">Nom</a> / <a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&sortorder=ASC&sortfield=d.societe\">Société</a></td>\n";
print "<td>";
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 "</td>\n";
print "<td>";
print_liste_field_titre("Email",$PHP_SELF,"d.email","&page=$page&statut=$statut");
print_liste_field_titre("Email",$PHP_SELF,"email","&page=$page");
print "</td>\n";
print "<td>";
print_liste_field_titre("Type",$PHP_SELF,"t.libelle","&page=$page&statut=$statut");
print_liste_field_titre("CP",$PHP_SELF,"cp","&page=$page");
print "</td>\n";
print "<td>";
print_liste_field_titre("Vile",$PHP_SELF,"ville","&page=$page");
print "</td>\n";
print "<td><a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&statut=$statut&sortorder=ASC&sortfield=d.morphy\">Personne</a></td>\n";
print "<td><a href=\"".$_SERVER['SCRIPT_NAME'] . "?page=$page&statut=$statut&sortorder=ASC&sortfield=d.statut\">Statut</a></td>\n";
print "<td>Action</td>\n";
print "<td>Photo</td>\n";
print "</TR>\n";
$var=True;
@ -84,34 +80,16 @@ if ($result)
$objp = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)."</a></TD>\n";
print "<TD>";
if ($objp->cotisation == 'yes')
{
if ($objp->datefin < time())
{
print "<b><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".strftime("%d %B %Y",$objp->datefin)."</a> - Cotisation non recue</b></td>\n";
}
else
{
print "<a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".strftime("%d %B %Y",$objp->datefin)."</a></td>\n";
}
}
else
{
print "&nbsp;</td>";
}
print "<TD><a href=\"priv_fiche.php?rowid=$objp->rowid\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)."</a></TD>\n";
print "<TD>$objp->naiss</TD>\n";
print "<TD>$objp->email</TD>\n";
print "<TD>$objp->type</TD>\n";
print "<TD>$objp->morphy</TD>\n";
print "<td>";
if ($objp->statut == -1)
{
print '<a href="fiche.php?rowid='.$objp->rowid.'">A valider</a>';
}
print "</td>";
print "<TD><a href=\"edit.php?rowid=$objp->rowid\">Editer</a><br><a href=\"fiche.php?rowid=$objp->rowid&action=resign\">Resilier</a><br><a href=\"fiche.php?rowid=$objp->rowid&action=delete\">Supprimer</a></TD>\n";
print "<TD>$objp->cp</TD>\n";
print "<TD>$objp->ville</TD>\n";
if (isset($objp->photo) && $objp->photo!= ''){
print "<TD><A HREF=\"$objp->photo\"><IMG SRC=\"$objp->photo\" HEIGHT=64 WIDTH=64></A></TD>\n";
}else{
print "<TD>&nbsp;</TD>\n";
}
print "</tr>";
$i++;
}