diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 0e5ae476949..d0e590f026c 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1,9 +1,9 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Benoit Mortier * * 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"); + } + } ?> diff --git a/htdocs/adherents/edit.php b/htdocs/adherents/edit.php index 63004c54fc3..869ca2ecf66 100644 --- a/htdocs/adherents/edit.php +++ b/htdocs/adherents/edit.php @@ -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 "
"; - print ''; + print '
'; print ""; print ""; @@ -153,20 +157,20 @@ if ($rowid) print ''; - print ''; + print ''; - print ''; + print ''; - print ''; - print ''; + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; // $myattr=$adho->fetch_name_optionals(); foreach($adho->attribute_label as $key=>$value){ diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index fb305bc212f..9b9d3d1f054 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 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 @@ -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
\n"; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Login"))."
\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
\n"; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Lastname"))."
\n"; + } + if (!isset($prenom) || $prenom=='') { + $error+=1; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Firstname"))."
\n"; } if (ADHERENT_MAIL_REQUIRED && ADHERENT_MAIL_REQUIRED == 1 && ! ValidEMail($email)) { $error+=1; - $errmsg .="Adresse Email invalide
\n"; + $errmsg .= "Adresse Email invalide
\n"; } if ($num !=0) { $error+=1; - $errmsg .="Login deja utilise. Veuillez en changer
\n"; + $errmsg .= "Login deja utilise. Veuillez en changer
\n"; } if (!isset($pass) || $pass == '' ) { $error+=1; - $errmsg .="Password invalide
\n"; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Password"))."
\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 '
'; print '
Prénom
'.$langs->trans("Firstname").'
Nom
'.$langs->trans("Name").'
Societe
Adresse'; + print '
'.$langs->trans("Company").'
'.$langs->trans("Address").''; print '
CP Ville
Pays
Email
Login
Password
Date de naissance
Format AAAA-MM-JJ
'.$langs->trans("Zip").'/'.$langs->trans("Town").'
'.$langs->trans("Country").'
'.$langs->trans("EMail").'
'.$langs->trans("Login").'
'.$langs->trans("Password").'
'.$langs->trans("Birthday").'
Format AAAA-MM-JJ
URL photo
'; - print ''; print "\n"; - print '
Erreur dans l\'execution du formulaire
$errmsg
'; + print '
'; } // 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 "\n"; print ''; + print ''; print ''; print ''; print '\n"; - print ''; print ''; @@ -542,211 +558,212 @@ if ($rowid > 0) // print ''; print ''; print ''; - print ''; + print ''; + print ''; + + foreach($adho->attribute_label as $key=>$value){ + print "\n"; + } + + print ''; + print "
'.$langs->trans("Ref").''.$adh->id.' '.$langs->trans("Comments").'
'.$langs->trans("Type").'*'.$adh->type."'; + print ''; print nl2br($adh->commentaire).' 
Personne'.$adh->getmorphylib().' 
Pass'.$adh->pass.' 
'.$langs->trans("Birthday").''.$adh->naiss.' 
URL Photo'.$adh->photo.' 
Public ?'; - if ($adh->public==1){ - print 'Yes'; - }else{ - print "No"; -} -print ' 
'.$langs->trans("Public").''; + if ($adh->public==1) print $langs->trans("Yes"); + else print $langs->trans("No"); + print '
'.$langs->trans("Status").''.$adh->getLibStatut($adh).'
$value".$adh->array_options["options_$key"]." 
\n"; + print "
"; + + print "\n"; -foreach($adho->attribute_label as $key=>$value){ - print "$value".$adh->array_options["options_$key"]." \n"; -} - -print "\n"; -print "
"; - -print "\n"; - - -/* - * Barre d'actions - * - */ -print '
'; - - -print "".$langs->trans("Edit").""; - -if ($adh->statut < 1) -{ - print "Valider l'adhésion\n"; -} - -if ($adh->statut == 1) -{ - print "Résilier l'adhésion\n"; -} - -print "id&action=delete\">".$langs->trans("Delete")."\n"; - -// Envoi fiche par mail -print "id&action=sendinfo\">Envoyer sa fiche a l'adhérent\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 '
'; + + + print "".$langs->trans("Edit").""; + + // Valider + if ($adh->statut < 1) { - print "id&action=del_glasnost\">Suppression dans Glasnost\n"; + print "Valider l'adhésion\n"; } - if ($isinglasnost == 0) { - print "id&action=add_glasnost\">Ajout dans Glasnost\n"; - } - if ($isinglasnost == -1) { - print '
Failed to connect to SPIP: '.$adh->errorstr.''; - } -} - -// Action SPIP -if (defined("ADHERENT_USE_SPIP") && ADHERENT_USE_SPIP ==1) -{ - $isinspip=$adh->is_in_spip(); - if ($isinspip == 1) + + // Envoi fiche par mail + print "id&action=sendinfo\">Envoyer sa fiche a l'adhérent\n"; + + // Résilier + if ($adh->statut == 1) { - print "id&action=del_spip\">Suppression dans Spip\n"; + print "Résilier l'adhésion\n"; } - if ($isinspip == 0) + + // Supprimer + if ($user->admin) { + print "id&action=delete\">".$langs->trans("Delete")."\n"; + } + + // Action Glasnost + if ($adht->vote == 'yes' && defined("ADHERENT_USE_GLASNOST") && ADHERENT_USE_GLASNOST ==1) { - print "id&action=add_spip\">Ajout dans Spip\n"; + define("XMLRPC_DEBUG", 1); + $isinglasnost=$adh->is_in_glasnost(); + if ($isinglasnost == 1) + { + print "id&action=del_glasnost\">Suppression dans Glasnost\n"; + } + if ($isinglasnost == 0) { + print "id&action=add_glasnost\">Ajout dans Glasnost\n"; + } + if ($isinglasnost == -1) { + print '
Failed to connect to SPIP: '.$adh->errorstr.''; + } } - if ($isinspip == -1) { - print '
Failed to connect to SPIP: '.$adh->errorstr.''; - } -} - -print '
'; -print "
\n"; - - - -/* - * Bandeau des cotisations - * - */ - -print ''; - -print ''; -if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && -defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ - print ''; - - - - -/* - * Ajout d'une nouvelle cotis - * - */ -if ($user->admin) -{ - print ''; - print ''; - print ''; - - print ''; - if ($adh->datefin < time()) + + print ''; + print "
\n"; + + + + /* + * Bandeau des cotisations + * + */ + + print '
'; -}else{ -print ''; -} - -/* - * - * 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 "\n"; - - print ''; - print "\n"; - print "\n"; - print "\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 ""; - print "\n"; - print ''; - print ""; - $i++; + $isinspip=$adh->is_in_spip(); + if ($isinspip == 1) + { + print "id&action=del_spip\">Suppression dans Spip\n"; + } + if ($isinspip == 0) + { + print "id&action=add_spip\">Ajout dans Spip\n"; + } + if ($isinspip == -1) { + print '
Failed to connect to SPIP: '.$adh->errorstr.''; + } } - print "
Date cotisationsMontant
".dolibarr_print_date($objp->dateadh)."'.price($objp->cotisation).'
"; -} -else -{ - print $sql; - print $db->error(); -} - -print '
Fin adhésion
'; + + print ''; + print ''; - print ''; - - print ''; - - print ""; + + print '\n"; - - if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && - defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ - print "'; - if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && - defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ - print ''; - } - print ''; - print "\n"; + + print ''; + print '
'; + + + /* + * 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 ''; - print dolibarr_print_date($adh->datefin)." ".img_warning(); + $num = $db->num_rows(); + $i = 0; + + print "\n"; + + print ''; + print "\n"; + print "\n"; + print "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ""; + print "\n"; + print ''; + print ""; + $i++; + } + print "
Date cotisations".$langs->trans("Amount")."
".dolibarr_print_date($objp->dateadh)."'.price($objp->cotisation).'
"; } else { - print '
'; - print dolibarr_print_date($adh->datefin); + dolibarr_print_error($db); } - print '
Nouvelle adhésion
Date de cotisation\n"; - if ($adh->datefin > 0) - { - print_date_select($adh->datefin + (3600*24)); - } - else - { - print_date_select(); - } - print "
'; - print "
Mode de paiement\n"; - print_type_paiement_select($db,'operation'); - print "
Numero de cheque\n"; - print ''; + /* + * Ajout d'une nouvelle cotisation + * + */ + // \todo Ajout du droit adherent cotisation + if ($user->rights->adherent->cotisation || 1==1) + { + print "\n"; + + print ''; + print ''; + print ''; + + print ''; + if ($adh->datefin < time()) + { + print ''; + print ''; + + print ''; + + print ""; + + + print "\n"; + + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + print "\n"; + } + print ''; + if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE !=0 && + defined("ADHERENT_BANK_USE_AUTO") && ADHERENT_BANK_USE_AUTO !=0){ + print ''; + } + print ''; + + print ''; + print '
'.$langs->trans("SubscriptionEndDate").''; + print dolibarr_print_date($adh->datefin)." ".img_warning($langs->trans("Late")); + } + else + { + print ''; + print dolibarr_print_date($adh->datefin); + } + print '
'.$langs->trans("NewCotisation").'
Date de cotisation\n"; + if ($adh->datefin > 0) + { + print_date_select($adh->datefin + (3600*24)); + } + else + { + print_date_select(); + } + print "
Mode de paiement\n"; + print_type_paiement_select($db,'operation'); print "
Numero de cheque\n"; + print ''; + print "
Cotisation euros
'.$langs->trans("Label").'datefin).'" >
'; } - print '
Cotisation euros
Libelledatefin).'" >
'; + } -print ''; - - -} - $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index d882ebb67d1..a3e9b628644 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 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 @@ -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 '
'; -print ''; +print '
'; print ''; print ''; -print ""; -print ""; -print ""; -print ""; +print ''; +print ''; +print ''; +print ''; print "\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) { diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index b5e2ac9d0eb..94450b73837 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 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 @@ -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 "\n"; print ""; print "
'.$langs->trans("Type").'A validerValidesCotisants à jourRésiliés'.$langs->trans("MembersStatusToValid").''.$langs->trans("MembersStatusValidated").''.$langs->trans("MembersStatusPayed").''.$langs->trans("MembersStatusResiliated").'
".$adh->getmorphylib($objp->morphy).""; - if ($objp->statut == -1) - { - print 'A valider'; - } - if ($objp->statut == 0) - { - print 'Résilié'; - } - if ($objp->statut == 1) - { - print 'Validé'; - } + if ($objp->statut == -1) print ''; + print $adh->LibStatut($objp->statut); + if ($objp->statut == -1) print ''; print "rowid&action=edit\">".img_edit()."   "; @@ -162,11 +154,10 @@ if ($result) $i++; } print "

\n"; - print ""; + print "
"; 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 "

\n"; }