Fix: Correction nombreux bugs sur gestion des adhrents (register_globals)

This commit is contained in:
Laurent Destailleur 2005-03-05 18:45:40 +00:00
parent 3ceab7f6e1
commit 31c3421fd0
5 changed files with 376 additions and 333 deletions

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
*
* 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
@ -24,7 +24,8 @@
*
*/
/*! \file htdocs/adherents/adherent.class.php
/**
\file htdocs/adherents/adherent.class.php
\ingroup adherent
\brief Fichier de la classe permettant la gestion d'un adhérent
\author Rodolphe Qiedeville
@ -36,7 +37,8 @@
*/
/*! \class Adherent
/**
\class Adherent
\brief Classe permettant la gestion d'un adhérent
*/
@ -66,7 +68,7 @@ class Adherent
var $errorstr;
/*!
/**
\brief Adherent
\param DB base de données
\param id id de l'adhérent
@ -84,7 +86,7 @@ class Adherent
}
/*!
/**
\brief function envoyant un email au destinataire (recipient) avec le text fourni en parametre.
\param recipients destinataires
\param text contenu du message
@ -152,7 +154,7 @@ class Adherent
}
}
/*!
/**
\brief imprime une liste d'erreur.
*/
@ -166,7 +168,7 @@ class Adherent
}
/*!
/**
\brief fonction qui renvoie la nature physique ou morale d'un adherent
\param morphy nature physique ou morale de l'adhérent
*/
@ -179,7 +181,7 @@ class Adherent
return $morphy;
}
/*!
/**
\brief fonction qui vérifie les données entrées
\param minimum
*/
@ -279,7 +281,7 @@ class Adherent
}
/*!
/**
\brief fonction qui crée l'adhérent
\param userid userid de l'adhérent
*/
@ -310,7 +312,7 @@ class Adherent
}
/*!
/**
\brief fonction qui met à jour l'adhérent
*/
function update()
@ -383,7 +385,7 @@ class Adherent
}
/*!
/**
\brief fonction qui supprime l'adhérent et les données associées
\param rowid
*/
@ -426,7 +428,7 @@ class Adherent
}
/*!
/**
\brief Fonction qui récupére l'adhérent en donnant son login
\param login login de l'adhérent
*/
@ -451,12 +453,11 @@ class Adherent
}
}
/*!
/**
\brief fonction qui récupére l'adhérent en donnant son rowid
\param rowid
*/
function fetch($rowid)
{
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.pays, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy, t.libelle as type";
@ -502,8 +503,9 @@ class Adherent
}
}
/*!
/**
\brief Fonction qui récupére les données optionelles de l'adhérent
\param rowid
*/
@ -577,7 +579,8 @@ class Adherent
}
}
/*!
/**
\brief fonction qui insère la cotisation dans la base de données
\param date
\param montant
@ -621,7 +624,7 @@ class Adherent
}
}
/*!
/**
\brief fonction qui vérifie que l'utilisateur est valide
\param userid userid de l'adhérent
*/
@ -648,7 +651,7 @@ class Adherent
}
}
/*!
/**
\brief fonction qui résilie un adhérent
\param userid userid de de l'adhérent
*/
@ -676,7 +679,7 @@ class Adherent
}
/*!
/**
\brief fonction qui ajoute l'adhérent au abonnements automatiques
\param adht
\remarks mailing-list, spip, glasnost, etc...
@ -721,9 +724,9 @@ class Adherent
}
/*!
\brief fonction qui supprime l'adhérent des abonnements automatiques
\param adht
/**
\brief fonction qui supprime l'adhérent des abonnements automatiques
\param adht
\remarks mailing-list, spip, glasnost, etc...
*/
@ -763,7 +766,7 @@ class Adherent
}
}
/*!
/**
\brief fonction qui donne les droits rédacteurs dans spip
*/
@ -795,7 +798,7 @@ class Adherent
}
}
/*!
/**
\brief fonction qui enlève les droits rédacteurs dans spip
*/
@ -824,7 +827,7 @@ class Adherent
}
}
/*!
/**
\brief Fonction qui dit si cet utilisateur est un rédacteur existant dans spip
\return int 1=existe, 0=n'existe pas, -1=erreur
*/
@ -874,7 +877,7 @@ class Adherent
}
/*!
/**
\brief Fonction qui ajoute l'utilisateur dans glasnost
*/
@ -939,7 +942,7 @@ class Adherent
}
}
/*!
/**
\brief fonction qui enlève l'utilisateur de glasnost
*/
@ -1044,7 +1047,7 @@ class Adherent
}
}
/*!
/**
\brief fonction qui vérifie si l'utilisateur est dans glasnost
*/
@ -1101,7 +1104,7 @@ class Adherent
}
}
/*!
/**
\brief fonction qui rajoute l'utilisateur dans mailman
*/
@ -1166,7 +1169,7 @@ class Adherent
}
}
/*!
/**
\brief fonction qui désinscrit l'utilisateur de toutes les mailing list mailman
\ remarks utilie lors de la résiliation d'adhésion
*/
@ -1235,5 +1238,29 @@ class Adherent
}
}
/**
* \brief Retourne le libellé du statut d'un adhérent (brouillon, validé, résilié)
* \param adh Objet adhérent
* \return string Libellé
*/
function getLibStatut()
{
return $this->LibStatut($this->statut);
}
/**
* \brief Renvoi le libellé d'un statut donné
* \param statut id statut
* \return string Libellé
*/
function LibStatut($statut)
{
global $langs;
$langs->load("members");
if ($statut == -1) return $langs->trans("MemberStatusDraft");
if ($statut == 1) return $langs->trans("MemberStatusActive");
if ($statut == 0) return $langs->trans("MemberStatusResiliated");
}
}
?>

View File

@ -22,7 +22,8 @@
*
*/
/*! \file htdocs/adherents/edit.php
/**
\file htdocs/adherents/edit.php
\ingroup adherent
\brief Page d'edition d'un adherent
\version $Revision$
@ -33,6 +34,9 @@ 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");
$langs->load("members");
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
@ -49,19 +53,19 @@ if ($action == 'update')
$adh = new Adherent($db);
$adh->id = $_POST["rowid"];
$adh->prenom = $prenom;
$adh->nom = $nom;
$adh->societe = $societe;
$adh->adresse = $adresse;
$adh->amount = $amount;
$adh->cp = $cp;
$adh->prenom = $_POST["prenom"];
$adh->nom = $_POST["nom"];
$adh->societe = $_POST["societe"];
$adh->adresse = $_POST["adresse"];
$adh->amount = $_POST["amount"];
$adh->cp = $_POST["cp"];
$adh->ville = $_POST["ville"];
$adh->email = $_POST["email"];
$adh->login = $_POST["login"];
$adh->pass = $_POST["pass"];
$adh->naiss = $_POST["naiss"];
$adh->photo = $_POST["photo"];
$adh->date = mktime(12, 0 , 0, $remonth, $reday, $reyear);
$adh->date = mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$adh->note = $_POST["note"];
$adh->pays = $_POST["pays"];
$adh->typeid = $_POST["type"];
@ -124,10 +128,10 @@ if ($rowid)
$adht = new AdherentType($db);
print_titre("Edition de la fiche adhérent");
print_titre($langs->trans("EditMember"));
print "<form action=\"edit.php\" method=\"post\">";
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print '<table class="border" width="100%">';
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
@ -153,20 +157,20 @@ if ($rowid)
print '<td rowspan="15" valign="top">';
print '<textarea name="comment" wrap="soft" cols="40" rows="15">'.$adh->commentaire.'</textarea></td></tr>';
print '<tr><td width="15%">Prénom</td><td width="35%"><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td></tr>';
print '<tr><td width="15%">'.$langs->trans("Firstname").'</td><td width="35%"><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td></tr>';
print '<tr><td>Nom</td><td><input type="text" name="nom" size="40" value="'.$adh->nom.'"></td></tr>';
print '<tr><td>'.$langs->trans("Name").'</td><td><input type="text" name="nom" size="40" value="'.$adh->nom.'"></td></tr>';
print '<tr><td>Societe</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
print '<tr><td>Adresse</td><td>';
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
print '<tr><td>'.$langs->trans("Address").'</td><td>';
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$adh->adresse.'</textarea></td></tr>';
print '<tr><td>CP Ville</td><td><input type="text" name="cp" size="6" value="'.$adh->cp.'"> <input type="text" name="ville" size="20" value="'.$adh->ville.'"></td></tr>';
print '<tr><td>Pays</td><td><input type="text" name="pays" size="40" value="'.$adh->pays.'"></td></tr>';
print '<tr><td>Email</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
print '<tr><td>Login</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
print '<tr><td>Password</td><td><input type="password" 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>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="6" value="'.$adh->cp.'"> <input type="text" name="ville" size="20" value="'.$adh->ville.'"></td></tr>';
print '<tr><td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40" value="'.$adh->pays.'"></td></tr>';
print '<tr><td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>';
print '<tr><td>'.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$adh->login.'"></td></tr>';
print '<tr><td>'.$langs->trans("Password").'</td><td><input type="password" name="pass" size="40" value="'.$adh->pass.'"></td></tr>';
print '<tr><td>'.$langs->trans("Birthday").'<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>';
// $myattr=$adho->fetch_name_optionals();
foreach($adho->attribute_label as $key=>$value){

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -22,23 +22,24 @@
*
*/
/*! \file htdocs/adherents/fiche.php
/**
\file htdocs/adherents/fiche.php
\ingroup adherent
\brief Page d'ajout, edition, suppression d'une fiche adhérent
\version $Revision$
\brief Page d'ajout, edition, suppression d'une fiche adhérent
\version $Revision$
*/
require("./pre.inc.php");
$langs->load("companies");
$langs->load("bills");
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");
require_once(DOL_DOCUMENT_ROOT."/adherents/XML-RPC.functions.php");
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
$langs->load("companies");
$langs->load("bills");
$langs->load("members");
$adho = new AdherentOptions($db);
$errmsg='';
@ -57,6 +58,11 @@ if ($_POST["action"] == 'sendinfo')
if ($_POST["action"] == 'cotisation')
{
$reday=$_POST["reday"];
$remonth=$_POST["remonth"];
$reyear=$_POST["reyear"];
$cotisation=$_POST["cotisation"];
$adh = new Adherent($db);
$adh->id = $rowid;
$adh->fetch($rowid);
@ -75,7 +81,6 @@ if ($_POST["action"] == 'cotisation')
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
$dateop=strftime("%Y%m%d",time());
//$dateop="$reyear$remonth$reday";
$amount=$cotisation;
$acct=new Account($db,ADHERENT_BANK_ACCOUNT);
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE,$user);
@ -120,6 +125,10 @@ if ($_POST["action"] == 'add')
$naiss=$_POST["note"];
$comment=$_POST["comment"];
$morphy=$_POST["morphy"];
$reday=$_POST["reday"];
$remonth=$_POST["remonth"];
$reyear=$_POST["reyear"];
$cotisation=$_POST["cotisation"];
$adh = new Adherent($db);
$adh->prenom = $prenom;
@ -152,28 +161,32 @@ if ($_POST["action"] == 'add')
// Test si le login existe deja
if(!isset($login) || $login==''){
$error+=1;
$errmsg .="Login vide. Veuillez en positionner un<br>\n";
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Login"))."<br>\n";
}
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='$login';";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows();
$num = $db->num_rows($result);
}
if (!isset($nom) || !isset($prenom) || $prenom=='' || $nom=='') {
if (!isset($nom) || $nom=='') {
$error+=1;
$errmsg .="Nom et Prénom obligatoires<br>\n";
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Lastname"))."<br>\n";
}
if (!isset($prenom) || $prenom=='') {
$error+=1;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Firstname"))."<br>\n";
}
if (ADHERENT_MAIL_REQUIRED && ADHERENT_MAIL_REQUIRED == 1 && ! ValidEMail($email)) {
$error+=1;
$errmsg .="Adresse Email invalide<br>\n";
$errmsg .= "Adresse Email invalide<br>\n";
}
if ($num !=0) {
$error+=1;
$errmsg .="Login deja utilise. Veuillez en changer<br>\n";
$errmsg .= "Login deja utilise. Veuillez en changer<br>\n";
}
if (!isset($pass) || $pass == '' ) {
$error+=1;
$errmsg .="Password invalide<br>\n";
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Password"))."<br>\n";
}
if (isset($naiss) && $naiss !=''){
if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$naiss)) {
@ -188,49 +201,51 @@ if ($_POST["action"] == 'add')
}
if (!$error) {
// Email a peu pres correct et le login n'existe pas
if ($adh->create($user->id))
{
if ($cotisation > 0)
// Email a peu pres correct et le login n'existe pas
if ($adh->create($user->id))
{
$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
// insertion dans la gestion banquaire si configure pour
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
$dateop=strftime("%Y%m%d",time());
//$dateop="$reyear$remonth$reday";
$amount=$cotisation;
$acct=new Account($db,ADHERENT_BANK_ACCOUNT);
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE);
if ($insertid == '')
{
dolibarr_print_error($db);
}
else
{
// met a jour la table cotisation
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=$crowid ";
$result = $db->query($sql);
if ($result)
{
//Header("Location: fiche.php");
}
else
if ($cotisation > 0)
{
$crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
// insertion dans la gestion banquaire si configure pour
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
$dateop=strftime("%Y%m%d",time());
$amount=$cotisation;
$acct=new Account($db,ADHERENT_BANK_ACCOUNT);
$insertid=$acct->addline($dateop, $_POST["operation"], $_POST["label"], $amount, $_POST["num_chq"],ADHERENT_BANK_CATEGORIE);
if ($insertid == '')
{
dolibarr_print_error($db);
}
else
{
// met a jour la table cotisation
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=$crowid ";
$result = $db->query($sql);
if ($result)
{
//Header("Location: fiche.php");
}
else
{
dolibarr_print_error($db);
}
}
}
}
Header("Location: liste.php?statut=-1");
}
else {
dolibarr_print_error($db);
}
Header("Location: liste.php?statut=-1");
}
else {
dolibarr_print_error($db);
$action = 'create';
}
}
}
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes)
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
{
$adh = new Adherent($db);
$adh->delete($rowid);
@ -240,7 +255,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes)
llxHeader();
if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes)
if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes')
{
$adh = new Adherent($db, $rowid);
$adh->validate($user->id);
@ -266,7 +281,7 @@ if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes)
}
if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == yes)
if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == 'yes')
{
$adh = new Adherent($db, $rowid);
$adh->resiliate($user->id);
@ -285,7 +300,7 @@ if ($_POST["action"] == 'confirm_resign' && $_POST["confirm"] == yes)
}
}
if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == yes)
if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == 'yes')
{
$adh = new Adherent($db, $rowid);
$adh->fetch($rowid);
@ -302,7 +317,7 @@ if ($_POST["action"] == 'confirm_add_glasnost' && $_POST["confirm"] == yes)
}
}
if ($_POST["action"] == 'confirm_del_glasnost' && $_POST["confirm"] == yes)
if ($_POST["action"] == 'confirm_del_glasnost' && $_POST["confirm"] == 'yes')
{
$adh = new Adherent($db, $rowid);
$adh->fetch($rowid);
@ -319,7 +334,7 @@ if ($_POST["action"] == 'confirm_del_glasnost' && $_POST["confirm"] == yes)
}
}
if ($_POST["action"] == 'confirm_del_spip' && $_POST["confirm"] == yes)
if ($_POST["action"] == 'confirm_del_spip' && $_POST["confirm"] == 'yes')
{
$adh = new Adherent($db, $rowid);
$adh->fetch($rowid);
@ -328,7 +343,7 @@ if ($_POST["action"] == 'confirm_del_spip' && $_POST["confirm"] == yes)
}
}
if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == yes)
if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == 'yes')
{
$adh = new Adherent($db, $rowid);
$adh->fetch($rowid);
@ -346,13 +361,13 @@ if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == yes)
if ($errmsg != '')
{
print '<table class="border" width="100%">';
print '<th>Erreur dans l\'execution du formulaire</th>';
print "<tr><td class=\"error\"><b>$errmsg</b></td></tr>\n";
print '</table>';
print '</table><br>';
}
// fetch optionals attributes and labels
$adho->fetch_optionals();
if ($action == 'create') {
print_titre($langs->trans("NewMember"));
@ -429,12 +444,13 @@ if ($action == 'create') {
}
/* ************************************************************************** */
/* */
/* Edition de la fiche */
/* */
/* ************************************************************************** */
if ($rowid > 0)
if ($rowid)
{
$adh = new Adherent($db);
$adh->id = $rowid;
@ -456,7 +472,7 @@ if ($rowid > 0)
$hselected=$h;
$h++;
dolibarr_fiche_head($head, $hselected, $societe->nom);
dolibarr_fiche_head($head, $hselected, $adh->fullname);
/*
* Confirmation de la suppression de l'adhérent
@ -516,15 +532,15 @@ if ($rowid > 0)
}
print "<form action=\"fiche.php\" method=\"post\">\n";
print '<table class="border" width="100%">';
print '<form action="fiche.php" method="post">';
print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur">'.$adh->id.'&nbsp;</td>';
print '<td valign="top" width="50%">'.$langs->trans("Comments").'</tr>';
print '<tr><td>'.$langs->trans("Type").'*</td><td class="valeur">'.$adh->type."</td>\n";
print '<td rowspan="'.(13+count($adh->array_options)).'" valign="top" width="50%">';
print '<td rowspan="'.(14+count($adh->array_options)).'" valign="top" width="50%">';
print nl2br($adh->commentaire).'&nbsp;</td></tr>';
print '<tr><td>Personne</td><td class="valeur">'.$adh->getmorphylib().'&nbsp;</td></tr>';
@ -542,211 +558,212 @@ if ($rowid > 0)
// print '<tr><td>Pass</td><td class="valeur">'.$adh->pass.'&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.$adh->naiss.'&nbsp;</td></tr>';
print '<tr><td>URL Photo</td><td class="valeur">'.$adh->photo.'&nbsp;</td></tr>';
print '<tr><td>Public ?</td><td class="valeur">';
if ($adh->public==1){
print 'Yes';
}else{
print "No";
}
print '&nbsp;</td></tr>';
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">';
if ($adh->public==1) print $langs->trans("Yes");
else print $langs->trans("No");
print '</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut($adh).'</td></tr>';
foreach($adho->attribute_label as $key=>$value){
print "<tr><td>$value</td><td>".$adh->array_options["options_$key"]."&nbsp;</td></tr>\n";
}
print '</form>';
print "</table>\n";
print "<br>";
print "</div>\n";
foreach($adho->attribute_label as $key=>$value){
print "<tr><td>$value</td><td>".$adh->array_options["options_$key"]."&nbsp;</td></tr>\n";
}
print "</table>\n";
print "<br>";
print "</div>\n";
/*
* Barre d'actions
*
*/
print '<div class="tabsAction">';
print "<a class=\"tabAction\" href=\"edit.php?rowid=$rowid\">".$langs->trans("Edit")."</a>";
if ($adh->statut < 1)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=valid\">Valider l'adhésion</a>\n";
}
if ($adh->statut == 1)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=resign\">Résilier l'adhésion</a>\n";
}
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
// Envoi fiche par mail
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">Envoyer sa fiche a l'adhérent</a>\n";
// Action Glasnost
if ($adht->vote == 'yes' && defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1)
{
define("XMLRPC_DEBUG", 1);
$isinglasnost=$adh->is_in_glasnost();
if ($isinglasnost == 1)
/*
* Barre d'actions
*
*/
print '<div class="tabsAction">';
print "<a class=\"tabAction\" href=\"edit.php?rowid=$rowid\">".$langs->trans("Edit")."</a>";
// Valider
if ($adh->statut < 1)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_glasnost\">Suppression dans Glasnost</a>\n";
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=valid\">Valider l'adhésion</a>\n";
}
if ($isinglasnost == 0) {
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_glasnost\">Ajout dans Glasnost</a>\n";
}
if ($isinglasnost == -1) {
print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>';
}
}
// Action SPIP
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1)
{
$isinspip=$adh->is_in_spip();
if ($isinspip == 1)
// Envoi fiche par mail
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">Envoyer sa fiche a l'adhérent</a>\n";
// Résilier
if ($adh->statut == 1)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_spip\">Suppression dans Spip</a>\n";
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$rowid&action=resign\">Résilier l'adhésion</a>\n";
}
if ($isinspip == 0)
// Supprimer
if ($user->admin) {
print "<a class=\"butDelete\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
}
// Action Glasnost
if ($adht->vote == 'yes' && defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_spip\">Ajout dans Spip</a>\n";
define("XMLRPC_DEBUG", 1);
$isinglasnost=$adh->is_in_glasnost();
if ($isinglasnost == 1)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_glasnost\">Suppression dans Glasnost</a>\n";
}
if ($isinglasnost == 0) {
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_glasnost\">Ajout dans Glasnost</a>\n";
}
if ($isinglasnost == -1) {
print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>';
}
}
if ($isinspip == -1) {
print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>';
}
}
print '</div>';
print "<br>\n";
/*
* Bandeau des cotisations
*
*/
print '<table class="border" width="100%">';
print '<tr>';
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
print '<td rowspan="8" valign="top">';
}else{
print '<td rowspan="6" valign="top">';
}
/*
*
* Liste des cotisations
*
*/
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=$rowid";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
print "<table class=\"noborder\" width=\"100%\">\n";
print '<tr class="liste_titre">';
print "<td>Date cotisations</td>\n";
print "<td align=\"right\">Montant</TD>\n";
print "</tr>\n";
$var=True;
while ($i < $num)
// Action SPIP
if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1)
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".dolibarr_print_date($objp->dateadh)."</td>\n";
print '<td align="right">'.price($objp->cotisation).'</td>';
print "</tr>";
$i++;
$isinspip=$adh->is_in_spip();
if ($isinspip == 1)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=del_spip\">Suppression dans Spip</a>\n";
}
if ($isinspip == 0)
{
print "<a class=\"tabAction\" href=\"fiche.php?rowid=$adh->id&action=add_spip\">Ajout dans Spip</a>\n";
}
if ($isinspip == -1) {
print '<br><font class="error">Failed to connect to SPIP: '.$adh->errorstr.'</font>';
}
}
print "</table>";
}
else
{
print $sql;
print $db->error();
}
print '</td>';
/*
* Ajout d'une nouvelle cotis
*
*/
if ($user->admin)
{
print '<form method="post" action="fiche.php">';
print '<input type="hidden" name="action" value="cotisation">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<td width="15%">Fin adhésion</td>';
if ($adh->datefin < time())
print '</div>';
print "<br>\n";
/*
* Bandeau des cotisations
*
*/
print '<table border=0 width="100%">';
print '<tr>';
print '<td valign="top">';
/*
* Liste des cotisations
*
*/
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=$rowid";
$result = $db->query($sql);
if ($result)
{
print '<td width="35%">';
print dolibarr_print_date($adh->datefin)." ".img_warning();
$num = $db->num_rows();
$i = 0;
print "<table class=\"noborder\" width=\"100%\">\n";
print '<tr class="liste_titre">';
print "<td>Date cotisations</td>\n";
print "<td align=\"right\">".$langs->trans("Amount")."</td>\n";
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".dolibarr_print_date($objp->dateadh)."</td>\n";
print '<td align="right">'.price($objp->cotisation).'</td>';
print "</tr>";
$i++;
}
print "</table>";
}
else
{
print '<td width="35%">';
print dolibarr_print_date($adh->datefin);
dolibarr_print_error($db);
}
print '</td>';
print '</tr>';
print '<tr><td colspan="2">Nouvelle adhésion</td></tr>';
print "<tr><td>Date de cotisation</td><td>\n";
if ($adh->datefin > 0)
{
print_date_select($adh->datefin + (3600*24));
}
else
{
print_date_select();
}
print "</td></tr>";
print '</td><td>';
print "<tr><td>Mode de paiement</td><td>\n";
print_type_paiement_select($db,'operation');
print "</td></tr>\n";
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
print "<tr><td>Numero de cheque</td><td>\n";
print '<input name="num_chq" type="text" size="6">';
/*
* Ajout d'une nouvelle cotisation
*
*/
// \todo Ajout du droit adherent cotisation
if ($user->rights->adherent->cotisation || 1==1)
{
print "<table class=\"border\" width=\"100%\">\n";
print '<form method="post" action="fiche.php">';
print '<input type="hidden" name="action" value="cotisation">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<tr><td width="15%">'.$langs->trans("SubscriptionEndDate").'</td>';
if ($adh->datefin < time())
{
print '<td width="35%">';
print dolibarr_print_date($adh->datefin)." ".img_warning($langs->trans("Late"));
}
else
{
print '<td width="35%">';
print dolibarr_print_date($adh->datefin);
}
print '</td>';
print '</tr>';
print '<tr><td colspan="2">'.$langs->trans("NewCotisation").'</td></tr>';
print "<tr><td>Date de cotisation</td><td>\n";
if ($adh->datefin > 0)
{
print_date_select($adh->datefin + (3600*24));
}
else
{
print_date_select();
}
print "</td></tr>";
print "<tr><td>Mode de paiement</td><td>\n";
print_type_paiement_select($db,'operation');
print "</td></tr>\n";
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
print "<tr><td>Numero de cheque</td><td>\n";
print '<input name="num_chq" type="text" size="6">';
print "</td></tr>\n";
}
print '<tr><td>Cotisation</td><td><input type="text" name="cotisation" size="6"> euros</td></tr>';
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2"><input name="label" type="text" size=20 value="Cotisation '.stripslashes($adh->prenom).' '.stripslashes($adh->nom).' '.strftime("%Y",$adh->datefin).'" ></td></tr>';
}
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"</td></tr>';
print '</form>';
print '</table>';
}
print '<tr><td>Cotisation</td><td colspan="2"><input type="text" name="cotisation" size="6"> euros</td></tr>';
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 &&
defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){
print '<tr><td>Libelle</td><td colspan="2"><input name="label" type="text" size=20 value="Cotisation '.stripslashes($adh->prenom).' '.stripslashes($adh->nom).' '.strftime("%Y",$adh->datefin).'" ></td></tr>';
}
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"</td></tr>';
print "</form>\n";
print '</td></tr>';
print '</table>';
}
print '</table>';
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -22,7 +22,7 @@
*
*/
/*!
/**
\file htdocs/adherents/index.php
\ingroup adherent
\brief Page accueil module adherents
@ -32,21 +32,22 @@
require("./pre.inc.php");
$langs->load("companies");
$langs->load("members");
llxHeader();
print_titre("Gestion des adhérents");
print_titre($langs->trans("MembersArea"));
print '<br>';
print '<table class="noborder" cellspacing="0" cellpadding="3">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td>';
print "<td align=right width=\"80\">A valider</td>";
print "<td align=right width=\"80\">Valides</td>";
print "<td align=right width=\"80\">Cotisants à jour</td>";
print "<td align=right width=\"80\">Résiliés</td>";
print '<td align=right width="80">'.$langs->trans("MembersStatusToValid").'</td>';
print '<td align=right width="80">'.$langs->trans("MembersStatusValidated").'</td>';
print '<td align=right width="80">'.$langs->trans("MembersStatusPayed").'</td>';
print '<td align=right width="80">'.$langs->trans("MembersStatusResiliated").'</td>';
print "</tr>\n";
$var=True;
@ -59,37 +60,40 @@ $AdherentsResilies=array();
$Cotisants=array();
# Liste les adherents
$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";
$sql = "SELECT count(*) as somme , t.rowid, t.libelle, d.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid";
$sql .= " GROUP BY t.libelle, d.statut";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$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; }
if ($objp->statut == 1) { $Adherents[$objp->libelle]=$objp->somme; }
if ($objp->statut == 0) { $AdherentsResilies[$objp->libelle]=$objp->somme; }
$i++;
}
$db->free();
$db->free($result);
}
# Liste les cotisants a jour
$sql = "SELECT count(*) as somme , t.libelle 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 = 1 AND d.datefin >= now() GROUP BY t.libelle";
$sql = "SELECT count(*) as somme , t.libelle";
$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 = 1 AND d.datefin >= now()";
$sql .= " GROUP BY t.libelle";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -22,7 +22,8 @@
*
*/
/*! \file htdocs/adherents/liste.php
/**
\file htdocs/adherents/liste.php
\ingroup adherent
\brief Page listant les adhérents
\version $Revision$
@ -40,8 +41,8 @@ $sortfield=$_GET["sortfield"];
$page=$_GET["page"];
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
if ($sortorder == "") { $sortorder="ASC"; }
if ($sortfield == "") { $sortfield="d.nom"; }
if (! $sortorder) { $sortorder="ASC"; }
if (! $sortfield) { $sortfield="d.nom"; }
if ($page == -1) { $page = 0 ; }
@ -77,8 +78,8 @@ if ($result)
$titre=$langs->trans("MembersList");
if (isset($_GET["statut"])) {
if ($statut == -1) { $titre=$langs->trans("MembersListToValid"); }
if ($statut == 1) { $titre=$langs->trans("MembersListValid"); }
if ($statut == 0) { $titre=$langs->trans("MembersListResiliated"); }
if ($statut == 1) { $titre=$langs->trans("MembersListValid"); }
if ($statut == 0) { $titre=$langs->trans("MembersListResiliated"); }
}
elseif ($_POST["action"] == 'search') {
$titre="Liste des adhérents répondant aux critères";
@ -142,18 +143,9 @@ if ($result)
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
print "<td>";
if ($objp->statut == -1)
{
print '<a href="fiche.php?rowid='.$objp->rowid.'">A valider</a>';
}
if ($objp->statut == 0)
{
print 'Résilié';
}
if ($objp->statut == 1)
{
print 'Validé';
}
if ($objp->statut == -1) print '<a href="fiche.php?rowid='.$objp->rowid.'">';
print $adh->LibStatut($objp->statut);
if ($objp->statut == -1) print '</a>';
print "</td>";
print "<td><a href=\"fiche.php?rowid=$objp->rowid&action=edit\">".img_edit()."</a> &nbsp; ";
@ -162,11 +154,10 @@ if ($result)
$i++;
}
print "</table><br>\n";
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print "<table class=\"noborder\" width=\"100%\">";
print_barre_liste("", $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",$sortfield,$sortorder,'',$num);
// print_fleche_navigation($page,"liste.php","&statut=$statut&sortorder=$sortorder&sortfield=$sortfield",1);
print "</table><br>\n";
}