diff --git a/htdocs/adherents/edit.php b/htdocs/adherents/edit.php
index c2680b7d495..0494d1c7637 100644
--- a/htdocs/adherents/edit.php
+++ b/htdocs/adherents/edit.php
@@ -26,7 +26,8 @@ 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");
-$adho = new AdherentOptions($db);
+$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
+$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
/*
* Enregistrer les modifs
@@ -91,6 +92,7 @@ llxHeader();
if ($rowid)
{
+ $adho = new AdherentOptions($db);
$adh = new Adherent($db);
$adh->id = $rowid;
$adh->fetch($rowid);
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 134474ab7a5..e70e2620420 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -33,6 +33,7 @@ $adho = new AdherentOptions($db);
$errmsg='';
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
+$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
if ($_POST["action"] == 'sendinfo')
@@ -94,12 +95,51 @@ if ($_POST["action"] == 'cotisation')
if ($_POST["action"] == 'add')
{
$type=$_POST["type"];
+ $nom=$_POST["nom"];
+ $prenom=$_POST["prenom"];
+ $societe=$_POST["societe"];
+ $adresse=$_POST["adresse"];
+ $cp=$_POST["cp"];
+ $ville=$_POST["ville"];
+ $naiss=$_POST["pays"];
+ $email=$_POST["email"];
+ $login=$_POST["login"];
+ $pass=$_POST["pass"];
+ $naiss=$_POST["naiss"];
+ $naiss=$_POST["photo"];
+ $naiss=$_POST["note"];
+ $comment=$_POST["comment"];
+ $morphy=$_POST["morphy"];
+
+ $adh = new Adherent($db);
+ $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 = $pass;
+ $adh->naiss = $naiss;
+ $adh->photo = $photo;
+ $adh->note = $note;
+ $adh->pays = $pays;
+ $adh->typeid = $type;
+ $adh->commentaire = $comment;
+ $adh->morphy = $morphy;
+ foreach($_POST as $key => $value){
+ if (ereg("^options_",$key)){
+ $adh->array_options[$key]=$_POST[$key];
+ }
+ }
+
+ // Test validite des paramètres
if(!isset($type) || $type==''){
$error+=1;
$errmsg .="Le type d'adhérent n'est pas renseigné. Vous devez configurer les types d'adhérents avant de pouvoir les ajouter.
\n";
}
- $login=$_POST["login"];
- // test si le login existe deja
+ // Test si le login existe deja
if(!isset($login) || $login==''){
$error+=1;
$errmsg .="Login vide. Veuillez en positionner un
\n";
@@ -134,34 +174,10 @@ if ($_POST["action"] == 'add')
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->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 = $pass;
- $adh->naiss = $naiss;
- $adh->photo = $photo;
- $adh->note = $note;
- $adh->pays = $pays;
- $adh->typeid = $type;
- $adh->commentaire = $_POST["comment"];
- $adh->morphy = $_POST["morphy"];
-
- foreach($_POST as $key => $value){
- if (ereg("^options_",$key)){
- $adh->array_options[$key]=$_POST[$key];
- }
+ $public=0;
}
+ if (!$error){
+ // email a peu pres correct et le login n'existe pas
if ($adh->create($user->id) )
{
if ($cotisation > 0)
@@ -195,7 +211,7 @@ if (!$error){
}
}
}
- Header("Location: liste.php");
+ Header("Location: liste.php?statut=-1");
}
}
}
@@ -207,6 +223,9 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes)
Header("Location: liste.php");
}
+llxHeader();
+
+
if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes)
{
$adh = new Adherent($db, $rowid);
@@ -252,8 +271,6 @@ if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == yes)
}
}
-llxHeader();
-
if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == yes)
{
$adh = new Adherent($db, $rowid);
@@ -349,11 +366,6 @@ if ($action == 'create') {
print '
| ';
print '| Prénom | |
';
-
-
-
-
-
print '| Nom | |
';
print '| Societe | |
';
print '| Adresse | ';
diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index c2466fa606a..86a756f40a5 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -48,7 +48,7 @@ $AdherentsResilies=array();
$Cotisants=array();
# Liste les adherents
-$sql = "SELECT count(*) as somme , t.libelle, d.statut FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
+$sql = "SELECT count(*) as somme , t.rowid, t.libelle, d.statut FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid GROUP BY t.libelle, d.statut";
$result = $db->query($sql);
@@ -60,7 +60,7 @@ if ($result)
while ($i < $num)
{
$objp = $db->fetch_object( $i);
- $AdherentsAll[$objp->libelle]+=$objp->somme;
+ $AdherentsAll[$objp->libelle]=$objp->rowid;
if ($objp->statut == -1) { $AdherentsAValider[$objp->libelle]=$objp->somme; }
if ($objp->statut == 1) { $Adherents[$objp->libelle]=$objp->somme; }
if ($objp->statut == 0) { $AdherentsResilies[$objp->libelle]=$objp->somme; }
@@ -97,11 +97,11 @@ $SommeD=0;
foreach ($AdherentsAll as $key=>$value){
$var=!$var;
print " |
";
- print '| '.$key.' | ';
- print ''.$AdherentsAValider[$key].' | ';
- print ''.$Adherents[$key].' | ';
- print ''.$Cotisants[$key].' | ';
- print ''.$AdherentsResilies[$key].' | ';
+ print ''.$key.' | ';
+ print ''.$AdherentsAValider[$key].' | ';
+ print ''.$Adherents[$key].' | ';
+ print ''.$Cotisants[$key].' | ';
+ print ''.($AdherentsResilies[$key]?$AdherentsResilies[$key]:0).' | ';
print "
\n";
$SommeA+=$AdherentsAValider[$key];
$SommeB+=$Adherents[$key];
@@ -121,7 +121,8 @@ print "";
print '
';
-print '";
-
-
$db->close();
llxFooter("Dernière modification $Date$ révision $Revision$");
diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php
index 8312e004f29..f36c821262c 100644
--- a/htdocs/adherents/liste.php
+++ b/htdocs/adherents/liste.php
@@ -31,6 +31,7 @@ llxHeader();
$sortorder=$_GET["sortorder"];
$sortfield=$_GET["sortfield"];
$page=$_GET["page"];
+$statut=isset($_GET["statut"])?$_GET["statut"]:1;
if ($sortorder == "") { $sortorder="ASC"; }
if ($sortfield == "") { $sortfield="d.nom"; }
@@ -42,15 +43,16 @@ $offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! isset($_GET["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 ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
-$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut";
+$sql .= " WHERE d.fk_adherent_type = t.rowid ";
+if ($_GET["type"]) {
+ $sql.=" AND t.rowid=".$_GET["type"];
+}
+if (isset($_GET["statut"])) {
+ $sql.=" AND d.statut = $statut";
+}
if ( $_POST["action"] == 'search')
{
if (isset($_POST['search']) && $_POST['search'] != ''){
@@ -66,17 +68,27 @@ if ($result)
$i = 0;
$titre="Liste des adhérents";
- if (isset($_GET["statut"]) && $_GET["statut"] == -1) { $titre="Liste des adhérents à valider"; }
- if (isset($_GET["statut"]) && $_GET["statut"] == 1) { $titre="Liste des adhérents valides"; }
- if (isset($_GET["statut"]) && $_GET["statut"] == 0) { $titre="Liste des adhérents résiliés"; }
+ if (isset($_GET["statut"])) {
+ if ($statut == -1) { $titre="Liste des adhérents à valider"; }
+ if ($statut == 1) { $titre="Liste des adhérents valides"; }
+ if ($statut == 0) { $titre="Liste des adhérents résiliés"; }
+ }
+ elseif ($_POST["action"] == 'search') {
+ $titre="Liste des adhérents répondant aux critères";
+ }
+
+ if ($_GET["type"]) {
+ $objp = $db->fetch_object(0);
+ $titre.=" (".$objp->type.")";
+ }
+
+ print_barre_liste($titre, $page, $PHP_SELF, "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
- print_barre_liste($titre, $page, $PHP_SELF, "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield");
print "";
print '';
print '| ';
- // print_liste_field_titre("Prenom",$PHP_SELF,"d.prenom","&page=$page&statut=$statut");
print_liste_field_titre("Prenom Nom / Société",$PHP_SELF,"d.nom","&page=$page&statut=$statut");
print " | \n";
@@ -106,8 +118,11 @@ if ($result)
$var=True;
while ($i < $num)
{
- $objp = $db->fetch_object($i);
-
+ if ($_GET["type"] && $i==0) { # Fetch deja fait
+ } else {
+ $objp = $db->fetch_object($i);
+ }
+
$adh=new Adherent($db);
$var=!$var;
@@ -161,10 +176,9 @@ if ($result)
print "
\n";
print "";
- print '';
- print '| ';
- print_fleche_navigation($page,$PHP_SELF,"&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",1);
- print ' | ';
+ print_barre_liste("", $page, $PHP_SELF, "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
+
+// print_fleche_navigation($page,$PHP_SELF,"&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",1);
print "
\n";
}
diff --git a/htdocs/adherents/options.php b/htdocs/adherents/options.php
index e1f7db823c8..05826a42142 100644
--- a/htdocs/adherents/options.php
+++ b/htdocs/adherents/options.php
@@ -1,6 +1,7 @@
- * Copyright (C) 2003 Jean-Louis Bergamo
+ * Copyright (C) 2003 Jean-Louis Bergamo
+ * Copyright (C) 2004 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
@@ -26,88 +27,94 @@ require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
$adho = new AdherentOptions($db);
$form = new Form($db);
-if ($HTTP_POST_VARS["action"] == 'add' && $user->admin)
+if ($_POST["action"] == 'add' && $user->admin)
{
- // type et taille non encore pris en compte => varchar(255)
- if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){
- $adho->create($_POST['attrname'],$_POST['type'],$_POST['size']);
- }
- if (isset($_POST['label'])){
- $adho->create_label($_POST['attrname'],$_POST['label']);
- }
- Header("Location: $PHP_SELF");
+ if ($_POST["button"] != "Annuler") {
+ // Type et taille non encore pris en compte => varchar(255)
+ if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){
+ $adho->create($_POST['attrname'],$_POST['type'],$_POST['size']);
+ }
+ if (isset($_POST['label'])){
+ $adho->create_label($_POST['attrname'],$_POST['label']);
+ }
+ }
+ Header("Location: ".$_SERVER["PHP_SELF"]);
}
-if ($HTTP_POST_VARS["action"] == 'update' && $user->admin)
+if ($_POST["action"] == 'update' && $user->admin)
{
- //if ($adho->update($user->id) )
- // {
- // }
- if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){
- $adho->update($_POST['attrname'],$_POST['type'],$_POST['size']);
- }
- if (isset($_POST['label'])){
- $adho->update_label($_POST['attrname'],$_POST['label']);
- }
- Header("Location: $PHP_SELF");
-
+ if ($_POST["button"] != "Annuler") {
+ if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_POST['attrname'])){
+ $adho->update($_POST['attrname'],$_POST['type'],$_POST['size']);
+ }
+ if (isset($_POST['label'])){
+ $adho->update_label($_POST['attrname'],$_POST['label']);
+ }
+ }
+ Header("Location: ".$_SERVER["PHP_SELF"]);
}
-if ($action == 'delete' && $user->admin)
+# Suppression attribut
+if ($_GET["action"] == 'delete' && $user->admin)
{
- if(isset($attrname) && preg_match("/^\w[a-zA-Z0-9-]*$/",$attrname)){
- $adho->delete($attrname);
+ if(isset($_GET["attrname"]) && preg_match("/^\w[a-zA-Z0-9-]*$/",$_GET["attrname"])){
+ $adho->delete($_GET["attrname"]);
}
- Header("Location: $PHP_SELF");
+ Header("Location: ".$_SERVER["PHP_SELF"]);
}
+
llxHeader();
-print_titre("Configuration des champs optionnels");
-/* ************************************************************************** */
-/* */
-/* */
-/* */
-/* ************************************************************************** */
+//if ($_GET["action"] != 'create') {
-$array_options=$adho->fetch_name_optionals();
-$array_label=$adho->fetch_name_optionals_label();
-if (sizeof($array_options)>0)
-{
- print "";
-
- print '';
- print "| Libelle | ";
- print "Nom de l'attribut | ";
- print "type | | | ";
- print "
\n";
-
- $var=True;
- foreach($adho->attribute_name as $key => $value)
+ print_titre("Configuration des champs optionnels");
+ print '
';
+
+ /* ************************************************************************** */
+ /* */
+ /* */
+ /* */
+ /* ************************************************************************** */
+
+ $array_options=$adho->fetch_name_optionals();
+ $array_label=$adho->fetch_name_optionals_label();
+ if (sizeof($array_options)>0)
{
- $var=!$var;
- print "";
- print "| ".$adho->attribute_label[$key]." | \n";
- print "$key | \n";
- print "$value | \n";
- print "Editer | \n";
- print "Supprimer | \n";
- print "
";
- // $i++;
+ print "";
+
+ print '';
+ print "| Libelle | ";
+ print "Nom de l'attribut | ";
+ print "Type | | ";
+ print "
\n";
+
+ $var=True;
+ foreach($adho->attribute_name as $key => $value)
+ {
+ $var=!$var;
+ print "";
+ print "| ".$adho->attribute_label[$key]." | \n";
+ print "$key | \n";
+ print "$value | \n";
+ print "".img_edit()."";
+ print " ".img_delete()." | \n";
+ print "
";
+ // $i++;
+ }
+ print "
";
+
+ /*
+ * Barre d'actions
+ *
+ */
+ print '";
}
- print "
";
-}
-
- /*
- * Barre d'actions
- *
- */
- print '";
-
+//}
/* ************************************************************************** */
/* */
@@ -115,39 +122,29 @@ if (sizeof($array_options)>0)
/* */
/* ************************************************************************** */
-
-if ($action == 'create') {
+if ($_GET["action"] == 'create') {
print_titre("Nouvel attribut");
+ print '
';
+
print "