New: Amélioration du module de gestion des adhérents

This commit is contained in:
Laurent Destailleur 2006-03-17 23:27:30 +00:00
parent 2c6d35827f
commit c1d35210aa
17 changed files with 579 additions and 281 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * 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>
* *
@ -87,24 +87,25 @@ class Adherent
} }
/** /**
\brief function envoyant un email au destinataire (recipient) avec le text fourni en parametre. \brief function envoyant un email au destinataire (recipient) avec le text fourni en parametre.
\param recipients destinataires \param recipients destinataires
\param text contenu du message \param text contenu du message
\param subject sujet du message \param subject sujet du message
\remarks La particularite de cette fonction est de remplacer certains champs \return int <0 si ko, >0 si ok
\remarks par leur valeur pour l'adherent en l'occurrence : \remarks La particularite de cette fonction est de remplacer certains champs
\remarks %PRENOM% : est remplace par le prenom \remarks par leur valeur pour l'adherent en l'occurrence :
\remarks %NOM% : est remplace par nom \remarks %PRENOM% : est remplace par le prenom
\remarks %INFOS% : l'ensemble des attributs de cet adherent \remarks %NOM% : est remplace par nom
\remarks %SERVEUR% : URL du serveur web \remarks %INFOS% : l'ensemble des attributs de cet adherent
\remarks etc.. \remarks %SERVEUR% : URL du serveur web
\todo Utiliser classe CMailFile \remarks etc..
*/ */
function send_an_email($recipients,$text,$subject="Vos coordonnees sur %SERVEUR%")
{
global $conf,$langs;
function send_an_email($recipients,$text,$subject="Vos coordonnees sur %SERVEUR%") $patterns = array (
{
$patterns = array (
'/%PRENOM%/', '/%PRENOM%/',
'/%NOM%/', '/%NOM%/',
'/%INFOS%/', '/%INFOS%/',
@ -121,16 +122,21 @@ class Adherent
'/%LOGIN%/', '/%LOGIN%/',
'/%PASS%/' '/%PASS%/'
); );
$infos = "Prenom : $this->prenom\nNom : $this->nom\nSociete : $this->societe\nAdresse : $this->adresse\nCP : $this->cp\nVille : $this->ville\nPays : $this->pays\nEmail : $this->email\nLogin : $this->login\nPassword : $this->pass\nDate de naissance : $this->naiss\nPhoto : $this->photo\n"; $infos.= $langs->trans("Lastname").": $this->nom\n";
if ($this->public == 1) $infos = $langs->trans("Firstname").": $this->prenom\n";
{ $infos.= $langs->trans("Company").": $this->societe\n";
$infos.="Fiche Publique : Oui\n"; $infos.= $langs->trans("Address").": $this->adresse\n";
} $infos.= $langs->trans("Zip").": $this->cp\n";
else $infos.= $langs->trans("Town").": $this->ville\n";
{ $infos.= $langs->trans("Country").": $this->pays\n";
$infos.="Fiche Publique : Non\n"; $infos.= $langs->trans("EMail").": $this->email\n";
} $infos.= $langs->trans("Login").": $this->login\n";
$replace = array ( $infos.= $langs->trans("Password").": $this->pass\n";
$infos.= $langs->trans("Birthday").": $this->naiss\n";
$infos.= $langs->trans("Photo").": $this->photo\n";
$infos.= $langs->trans("Public").": ".yn($this->public)."\n";
$replace = array (
$this->prenom, $this->prenom,
$this->nom, $this->nom,
$infos, $infos,
@ -147,14 +153,29 @@ class Adherent
$this->login, $this->login,
$this->pass $this->pass
); );
$texttosend = preg_replace ($patterns, $replace, $text); $texttosend = preg_replace ($patterns, $replace, $text);
$subjectosend = preg_replace ($patterns, $replace, $subject); $subjectosend = preg_replace ($patterns, $replace, $subject);
if (defined('ADHERENT_MAIL_FROM') && ADHERENT_MAIL_FROM != ''){
return mail($recipients,$subjectosend,$texttosend,"From: ".ADHERENT_MAIL_FROM."\nReply-To: ".ADHERENT_MAIL_FROM."\nX-Mailer: php/" . phpversion()); // Envoi mail confirmation
}else{ include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
return mail($recipients,$subjectosend,$texttosend);
} $from=$conf->email_from;
} if ($conf->global->ADHERENT_MAIL_FROM) $from=$conf->global->ADHERENT_MAIL_FROM;
$mailfile = new CMailFile($subject,$this->email,$from,$mesg,array(),array(),array());
if ($mailfile->sendfile())
{
return 1;
}
else
{
$this->error=$langs->trans("ErrorFailedToSendPassword");
return -1;
}
}
/** /**
\brief imprime une liste d'erreur. \brief imprime une liste d'erreur.
@ -284,109 +305,120 @@ class Adherent
} }
/** /**
\brief fonction qui crée l'adhérent \brief Fonction qui crée l'adhérent
\param userid userid de l'adhérent \param userid userid de l'adhérent
*/ \return int <0 si ko, >0 si ok
*/
function create($userid) function create($userid)
{
/*
* Insertion dans la base
*/
$this->date = $this->db->idate($this->date);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent (datec)";
$sql .= " VALUES (now())";
$result = $this->db->query($sql);
if ($result)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent"); global $conf,$langs;
return $this->update();
// Verification parametres
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email)) {
$this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1;
}
$this->date = $this->db->idate($this->date);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent (datec)";
$sql .= " VALUES (now())";
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
return $this->update();
}
else
{
dolibarr_print_error($this->db);
return -1;
}
} }
else
/**
\brief fonction qui met à jour l'adhérent
\return int <0 si ko, >0 si ok
*/
function update()
{ {
dolibarr_print_error($this->db); global $conf,$langs;
return 0;
// Verification parametres
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email)) {
$this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql .= " prenom = '".$this->prenom ."'";
$sql .= ",nom='" .$this->nom."'";
$sql .= ",societe='".$this->societe."'";
$sql .= ",adresse='".$this->adresse."'";
$sql .= ",cp='" .$this->cp."'";
$sql .= ",ville='" .$this->ville."'";
$sql .= ",pays='" .$this->pays_code."'";
$sql .= ",note='" .$this->commentaire."'";
$sql .= ",email='" .$this->email."'";
$sql .= ",login='" .$this->login."'";
$sql .= ",pass='" .$this->pass."'";
$sql .= ",naiss=" .$this->naiss?"'".$this->naiss."'":"null";
$sql .= ",photo=" .$this->photo?"'".$this->photo."'":"null";
$sql .= ",public='" .$this->public."'";
$sql .= ",statut=" .$this->statut;
$sql .= ",fk_adherent_type=".$this->typeid;
$sql .= ",morphy='".$this->morphy."'";
$sql .= " WHERE rowid = ".$this->id;
$result = $this->db->query($sql);
if (!$result)
{
dolibarr_print_error($this->db);
return -1;
}
if (sizeof($this->array_options) > 0 )
{
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE adhid = ".$this->id;
$this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options (adhid";
foreach($this->array_options as $key => $value)
{
// recupere le nom de l'attribut
$attr=substr($key,8);
$sql.=",$attr";
}
$sql .= ") VALUES ($this->id";
foreach($this->array_options as $key => $value)
{
$sql.=",'".$this->array_options[$key]."'";
}
$sql.=");";
$result = $this->db->query($sql);
if ($result)
{
return 1;
}
else
{
dolibarr_print_error($this->db);
return -2;
}
}
return 1;
} }
}
/**
\brief fonction qui met à jour l'adhérent
*/
function update()
{
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql .= " prenom = '".$this->prenom ."'";
$sql .= ",nom='" .$this->nom."'";
$sql .= ",societe='".$this->societe."'";
$sql .= ",adresse='".$this->adresse."'";
$sql .= ",cp='" .$this->cp."'";
$sql .= ",ville='" .$this->ville."'";
$sql .= ",pays='" .$this->pays."'";
$sql .= ",note='" .$this->commentaire."'";
$sql .= ",email='" .$this->email."'";
$sql .= ",login='" .$this->login."'";
$sql .= ",pass='" .$this->pass."'";
if ($this->naiss) $sql .= ",naiss='" .$this->naiss."'";
else $sql .= ",naiss=null";
$sql .= ",photo='" .$this->photo."'";
$sql .= ",public='" .$this->public."'";
$sql .= ",statut=" .$this->statut;
$sql .= ",fk_adherent_type=".$this->typeid;
$sql .= ",morphy='".$this->morphy."'";
$sql .= " WHERE rowid = $this->id";
$result = $this->db->query($sql);
if (!$result)
{
dolibarr_print_error($this->db);
return 0;
}
if (sizeof($this->array_options) > 0 )
{
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."adherent_options WHERE adhid = $this->id;";
$this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_options (adhid";
foreach($this->array_options as $key => $value)
{
// recupere le nom de l'attribut
$attr=substr($key,8);
$sql.=",$attr";
}
$sql .= ") VALUES ($this->id";
foreach($this->array_options as $key => $value)
{
$sql.=",'".$this->array_options[$key]."'";
}
$sql.=");";
$result = $this->db->query($sql);
if ($result)
{
return 1;
}
else
{
dolibarr_print_error($this->db);
return 0;
}
}
return 1;
}
/** /**
@ -469,9 +501,9 @@ class Adherent
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy, t.libelle as type"; $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.statut, d.public, d.adresse, d.cp, d.ville, d.note, d.email, d.login, d.pass, d.naiss, d.photo, d.fk_adherent_type, d.morphy, t.libelle as type";
$sql .= ",".$this->db->pdate("d.datefin")." as datefin"; $sql .= ",".$this->db->pdate("d.datefin")." as datefin";
$sql .= ", d.pays, p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib"; $sql .= ", d.pays, p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.pays = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.pays = p.rowid";
$sql .= " WHERE d.rowid = $rowid AND d.fk_adherent_type = t.rowid"; $sql .= " WHERE d.rowid = ".$rowid." AND d.fk_adherent_type = t.rowid";
$result=$this->db->query( $sql); $result=$this->db->query( $sql);
if ($result) if ($result)
@ -1257,10 +1289,10 @@ class Adherent
} }
} }
/** /**
* \brief Retourne le nom complet de l'adhérent * \brief Retourne le nom complet de l'adhérent
* \return string Nom complet * \return string Nom complet
*/ */
function getFullname() function getFullname()
{ {
if ($this->nom && $this->prenom) return $this->nom.' '.$this->prenom; if ($this->nom && $this->prenom) return $this->nom.' '.$this->prenom;
@ -1269,27 +1301,56 @@ class Adherent
return ''; return '';
} }
/** /**
* \brief Retourne le libellé du statut d'un adhérent (brouillon, validé, résilié) * \brief Retourne le libellé du statut d'un adhérent (brouillon, validé, résilié)
* \return string Libellé * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long
*/ * \return string Libellé
function getLibStatut() */
function getLibStatut($mode=0)
{ {
return $this->LibStatut($this->statut); return $this->LibStatut($this->statut,$mode);
} }
/** /**
* \brief Renvoi le libellé d'un statut donné * \brief Renvoi le libellé d'un statut donné
* \param statut id statut * \param statut id statut
* \return string Libellé * \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long
*/ * \return string Libellé
function LibStatut($statut) */
function LibStatut($statut,$mode=0)
{ {
global $langs; global $langs;
$langs->load("members"); $langs->load("members");
if ($statut == -1) return $langs->trans("MemberStatusDraft"); if ($mode == 0)
if ($statut == 1) return $langs->trans("MemberStatusActive"); {
if ($statut == 0) return $langs->trans("MemberStatusResiliated"); if ($statut == -1) return $langs->trans("MemberStatusDraft");
if ($statut == 1) return $langs->trans("MemberStatusActive");
if ($statut == 0) return $langs->trans("MemberStatusResiliated");
}
if ($mode == 1)
{
if ($statut == -1) return $langs->trans("MemberStatusDraft");
if ($statut == 1) return $langs->trans("MemberStatusActive");
if ($statut == 0) return $langs->trans("MemberStatusResiliated");
}
if ($mode == 2)
{
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft");
if ($statut == 1) return img_picto($langs->trans('MemberStatusActive'),'statut4').' '.$langs->trans("MemberStatusActive");
if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliated");
}
if ($mode == 3)
{
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0');
if ($statut == 1) return img_picto($langs->trans('MemberStatusActive'),'statut4');
if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5');
}
if ($mode == 4)
{
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft");
if ($statut == 1) return img_picto($langs->trans('MemberStatusActive'),'statut4').' '.$langs->trans("MemberStatusActive");
if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliated");
}
} }

View File

@ -45,7 +45,7 @@ function llxHeader($head = "") {
$menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=1&amp;filter=uptodate",$langs->trans("MenuMembersUpToDate")); $menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=1&amp;filter=uptodate",$langs->trans("MenuMembersUpToDate"));
$menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=0",$langs->trans("MenuMembersResiliated")); $menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=0",$langs->trans("MenuMembersResiliated"));
$menu->add(DOL_URL_ROOT."/public/adherents/","Espace adherents public"); $menu->add(DOL_URL_ROOT."/public/adherents/index.php?leftmenu=member_public",$langs->trans("MemberPublicLinks"));
$menu->add(DOL_URL_ROOT."/adherents/index.php",$langs->trans("Exports")); $menu->add(DOL_URL_ROOT."/adherents/index.php",$langs->trans("Exports"));
$menu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas")); $menu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas"));

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -47,6 +47,11 @@ $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
/*
* Actions
*/
if ($_POST["action"] == 'sendinfo') if ($_POST["action"] == 'sendinfo')
{ {
$adh = new Adherent($db); $adh = new Adherent($db);
@ -55,7 +60,6 @@ if ($_POST["action"] == 'sendinfo')
$adh->send_an_email($adh->email,"Voici le contenu de votre fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent"); $adh->send_an_email($adh->email,"Voici le contenu de votre fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent");
} }
if ($_POST["action"] == 'cotisation') if ($_POST["action"] == 'cotisation')
{ {
$reday=$_POST["reday"]; $reday=$_POST["reday"];
@ -73,9 +77,9 @@ if ($_POST["action"] == 'cotisation')
// Rajout du nouveau cotisant dans les listes qui vont bien // Rajout du nouveau cotisant dans les listes qui vont bien
// if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == "0000-00-00 00:00:00"){ // if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == "0000-00-00 00:00:00"){
if (defined("ADHERENT_MAILMAN_LISTS_COTISANT") && ADHERENT_MAILMAN_LISTS_COTISANT!='' && $adh->datefin == 0) if ($conf->global->ADHERENT_MAILMAN_LISTS_COTISANT && $adh->datefin == 0)
{ {
$adh->add_to_mailman(ADHERENT_MAILMAN_LISTS_COTISANT); $adh->add_to_mailman($conf->global->ADHERENT_MAILMAN_LISTS_COTISANT);
} }
$crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); $crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
@ -133,8 +137,9 @@ if ($_POST["action"] == 'cotisation')
} }
// Envoi mail // Envoi mail
if (defined("ADHERENT_MAIL_COTIS") && defined("ADHERENT_MAIL_COTIS_SUBJECT")){ if ($conf->global->ADHERENT_MAIL_COTIS)
$adh->send_an_email($adh->email,ADHERENT_MAIL_COTIS,ADHERENT_MAIL_COTIS_SUBJECT); {
$adh->send_an_email($adh->email,$conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
} }
} }
else else
@ -143,13 +148,80 @@ if ($_POST["action"] == 'cotisation')
$adh->id = $rowid; $adh->id = $rowid;
$adh->fetch($rowid); $adh->fetch($rowid);
} }
$mesg='<div class="error">'.$langs->trans("FieldRequired",$langs->trans("Amount")).'</div>'; $errmsg=$langs->trans("FieldRequired",$langs->trans("Amount"));
$action = "edit"; $action = "edit";
} }
if ($action == 'update')
{
if ($_POST["bouton"] == $langs->trans("Save"))
{
$datenaiss=mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$adh = new Adherent($db);
$adh->id = $_POST["rowid"];
$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 = $datenaiss;
$adh->note = $_POST["note"];
$adh->pays = $_POST["pays"];
$adh->typeid = $_POST["type"];
$adh->commentaire = $_POST["comment"];
$adh->morphy = $_POST["morphy"];
// recuperation du statut et public
$adh->statut = $_POST["statut"];
$adh->public = $_POST["public"];
foreach($_POST as $key => $value){
if (ereg("^options_",$key)){
$adh->array_options[$key]=$_POST[$key];
}
}
if ($adh->update($user->id)>=0)
{
Header("Location: fiche.php?rowid=".$adh->id);
exit;
}
else
{
$errmsg=$adh->error;
$action='';
}
}
else
{
Header("Location: fiche.php?rowid=".$rowid);
exit;
}
}
if ($_POST["action"] == 'add') if ($_POST["action"] == 'add')
{ {
$datenaiss='';
if (isset($_POST["naissday"]) && $_POST["naissday"]
&& isset($_POST["naissmonth"])
&& isset($_POST["naissyear"]) && $_POST["naissyear"])
{
$datenaiss=mktime(12, 0 , 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]);
}
$datecotisation='';
if (isset($_POST["naissday"]) && isset($_POST["naissmonth"]) && isset($_POST["naissyear"]))
{
$datecotisation=mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
}
$type=$_POST["type"]; $type=$_POST["type"];
$nom=$_POST["nom"]; $nom=$_POST["nom"];
$prenom=$_POST["prenom"]; $prenom=$_POST["prenom"];
@ -157,18 +229,14 @@ if ($_POST["action"] == 'add')
$adresse=$_POST["adresse"]; $adresse=$_POST["adresse"];
$cp=$_POST["cp"]; $cp=$_POST["cp"];
$ville=$_POST["ville"]; $ville=$_POST["ville"];
$pays=$_POST["pays"]; $pays_code=$_POST["pays_code"];
$email=$_POST["email"]; $email=$_POST["member_email"];
$login=$_POST["login"]; $login=$_POST["member_login"];
$pass=$_POST["pass"]; $pass=$_POST["member_pass"];
$naiss=$_POST["naiss"];
$photo=$_POST["photo"]; $photo=$_POST["photo"];
$note=$_POST["note"]; $note=$_POST["note"];
$comment=$_POST["comment"]; $comment=$_POST["comment"];
$morphy=$_POST["morphy"]; $morphy=$_POST["morphy"];
$reday=$_POST["reday"];
$remonth=$_POST["remonth"];
$reyear=$_POST["reyear"];
$cotisation=$_POST["cotisation"]; $cotisation=$_POST["cotisation"];
$adh = new Adherent($db); $adh = new Adherent($db);
@ -178,11 +246,11 @@ if ($_POST["action"] == 'add')
$adh->adresse = $adresse; $adh->adresse = $adresse;
$adh->cp = $cp; $adh->cp = $cp;
$adh->ville = $ville; $adh->ville = $ville;
$adh->pays = $pays; $adh->pays_code = $pays_code;
$adh->email = $email; $adh->email = $email;
$adh->login = $login; $adh->login = $login;
$adh->pass = $pass; $adh->pass = $pass;
$adh->naiss = $naiss; $adh->naiss = $datenaiss;
$adh->photo = $photo; $adh->photo = $photo;
$adh->note = $note; $adh->note = $note;
$adh->typeid = $type; $adh->typeid = $type;
@ -231,17 +299,8 @@ if ($_POST["action"] == 'add')
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Password"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Password"))."<br>\n";
} }
if (isset($naiss) && $naiss !=''){ $public=0;
if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$naiss)) { if (isset($public)) $public=1;
$error++;
$errmsg .= $langs->trans("DateSubscription")." (".$langs->trans("DateFormatYYYYMMDD").")<br>\n";
}
}
if (isset($public)) {
$public=1;
} else {
$public=0;
}
if (!$error) if (!$error)
{ {
@ -250,9 +309,10 @@ if ($_POST["action"] == 'add')
{ {
if ($cotisation > 0) if ($cotisation > 0)
{ {
$crowid=$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation); $crowid=$adh->cotisation($datecotisation, $cotisation);
// insertion dans la gestion banquaire si configure pour // insertion dans la gestion banquaire si configure pour
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE) if ($global->conf->ADHERENT_BANK_USE)
{ {
$dateop=strftime("%Y%m%d",time()); $dateop=strftime("%Y%m%d",time());
$amount=$cotisation; $amount=$cotisation;
@ -265,7 +325,8 @@ if ($_POST["action"] == 'add')
else else
{ {
// met a jour la table cotisation // met a jour la table cotisation
$sql="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=$insertid WHERE rowid=$crowid "; $sql ="UPDATE ".MAIN_DB_PREFIX."cotisation";
$sql.=" SET fk_bank=$insertid WHERE rowid=$crowid ";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
@ -279,6 +340,7 @@ if ($_POST["action"] == 'add')
} }
} }
Header("Location: liste.php?statut=-1"); Header("Location: liste.php?statut=-1");
exit;
} }
else { else {
dolibarr_print_error($db); dolibarr_print_error($db);
@ -294,6 +356,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->delete($rowid); $adh->delete($rowid);
Header("Location: liste.php"); Header("Location: liste.php");
exit;
} }
@ -308,12 +371,13 @@ if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes')
if (isset($adht->mail_valid) && $adht->mail_valid != '') if (isset($adht->mail_valid) && $adht->mail_valid != '')
{ {
$adh->send_an_email($adh->email,$adht->mail_valid,$conf->adherent->email_valid_subject); $result=$adh->send_an_email($adh->email,$adht->mail_valid,$conf->adherent->email_valid_subject);
} }
else else
{ {
$adh->send_an_email($adh->email,$conf->adherent->email_valid,$conf->adherent->email_valid_subject); $result=$adh->send_an_email($adh->email,$conf->adherent->email_valid,$conf->adherent->email_valid_subject);
} }
// rajoute l'utilisateur dans les divers abonnements .. // rajoute l'utilisateur dans les divers abonnements ..
if (!$adh->add_to_abo($adht)) if (!$adh->add_to_abo($adht))
{ {
@ -392,38 +456,137 @@ if ($_POST["action"] == 'confirm_add_spip' && $_POST["confirm"] == 'yes')
/*
*
*/
llxHeader(); llxHeader();
/* ************************************************************************** */
/* */
/* Création d'une fiche */
/* */
/* ************************************************************************** */
if ($errmsg != '') if ($errmsg != '')
{ {
print '<table class="border" width="100%">'; print '<div class="error">'.$errmsg.'</div>';
print "<tr><td class=\"error\"><b>$errmsg</b></td></tr>\n"; print "\n";
print '</table><br>';
} }
// fetch optionals attributes and labels // fetch optionals attributes and labels
$adho->fetch_optionals(); $adho->fetch_optionals();
if ($action == 'edit')
{
/********************************************
*
* Fiche en mode edition
*
********************************************/
$adho = new AdherentOptions($db);
$adh = new Adherent($db);
$adh->id = $rowid;
$adh->fetch($rowid);
// fetch optionals value
$adh->fetch_optionals($rowid);
// fetch optionals attributes and labels
$adho->fetch_optionals();
$adht = new AdherentType($db);
/*
* Affichage onglets
*/
$h = 0;
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$rowid;
$head[$h][1] = $langs->trans("MemberCard");
$hselected=$h;
$h++;
dolibarr_fiche_head($head, $hselected, $adh->fullname);
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<table class="border" width="100%">';
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
print "<input type=\"hidden\" name=\"statut\" value=\"".$adh->statut."\">";
print "<input type=\"hidden\" name=\"public\" value=\"".$adh->public."\">";
$htmls = new Form($db);
print '<tr><td>'.$langs->trans("Type").'</td><td>';
$htmls->select_array("type", $adht->liste_array(), $adh->typeid);
print "</td>";
print '<td valign="top" width="50%">'.$langs->trans("Comments").'</td></tr>';
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Morale");
print "<tr><td>".$langs->trans("Person")."</td><td>";
$htmls->select_array("morphy", $morphys, $adh->morphy);
print "</td>";
$rowspan=13;
print '<td rowspan="'.$rowspan.'" valign="top">';
print '<textarea name="comment" wrap="soft" cols="40" rows="15">'.$adh->commentaire.'</textarea></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>'.$langs->trans("Name").'</td><td><input type="text" name="nom" size="40" value="'.$adh->nom.'"></td></tr>';
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="2">'.$adh->adresse.'</textarea></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="32" value="'.$adh->ville.'"></td></tr>';
print '<tr><td>'.$langs->trans("Country").'</td><td>';
$htmls->select_pays($adh->pays_code?$adh->pays_code:$mysoc->pays_code,'pays');
print '</td></tr>';
print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</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>';
// Date naissance
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
$htmls->select_date(-1,'naiss','','',1,'update');
print "</td></tr>\n";
// Url photo
print '<tr><td>URL photo</td><td><input type="text" name="photo" size="40" value="'.$adh->photo.'"></td></tr>';
foreach($adho->attribute_label as $key=>$value)
{
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\" value=\"".$adh->array_options["options_$key"]."\"></td></tr>\n";
}
print '<tr><td colspan="2" align="center">';
print '<input type="submit" class="button" name="bouton" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print '</table>';
print '</form>';
print '</div>';
}
if ($action == 'create') if ($action == 'create')
{ {
/* ************************************************************************** */
print_titre($langs->trans("NewMember")); /* */
print "<form name='add' action=\"fiche.php\" method=\"post\">\n"; /* Fiche création */
print '<table class="border" width="100%">'; /* */
/* ************************************************************************** */
print '<input type="hidden" name="action" value="add">';
$htmls = new Form($db); $htmls = new Form($db);
$adht = new AdherentType($db); $adht = new AdherentType($db);
print_titre($langs->trans("NewMember"));
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="action" value="add">';
print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans("MemberType").'</td><td width="35%">'; print '<tr><td width="15%">'.$langs->trans("MemberType").'</td><td width="35%">';
$listetype=$adht->liste_array(); $listetype=$adht->liste_array();
if (sizeof($listetype)) { if (sizeof($listetype)) {
@ -442,21 +605,28 @@ if ($action == 'create')
$htmls->select_array("morphy", $morphys); $htmls->select_array("morphy", $morphys);
print "</td>\n"; print "</td>\n";
print '<td valign="top" rowspan="12"><textarea name="comment" wrap="soft" cols="40" rows="16"></textarea></td></tr>'; $rowspan=12;
print '<td valign="top" rowspan="'.$rowspan.'"><textarea name="comment" wrap="soft" cols="60" rows="12"></textarea></td></tr>';
print '<tr><td>'.$langs->trans("Firstname").'*</td><td><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td></tr>'; print '<tr><td>'.$langs->trans("Firstname").'*</td><td><input type="text" name="prenom" size="40" value="'.$adh->prenom.'"></td></tr>';
print '<tr><td>'.$langs->trans("Lastname").'*</td><td><input type="text" name="nom" value="'.$adh->nom.'" size="40"></td></tr>'; print '<tr><td>'.$langs->trans("Lastname").'*</td><td><input type="text" name="nom" value="'.$adh->nom.'" size="40"></td></tr>';
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("Company").'</td><td><input type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
print '<textarea name="adresse" wrap="soft" cols="40" rows="2"></textarea></td></tr>'; print '<textarea name="adresse" wrap="soft" cols="40" rows="2"></textarea></td></tr>';
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="40" value="'.$adh->ville.'"></td></tr>'; print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8"> <input type="text" name="ville" size="32" value="'.$adh->ville.'"></td></tr>';
print '<tr><td>'.$langs->trans("Country").'</td><td>'; print '<tr><td>'.$langs->trans("Country").'</td><td>';
$htmls->select_pays($adh->pays?$adh->pays:$mysoc->pays,'pays'); $htmls->select_pays($adh->pays_code?$adh->pays_code:$mysoc->pays_code,'pays_code');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="email" size="40" value="'.$adh->email.'"></td></tr>'; print '<tr><td>'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="member_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("Login").'*</td><td><input type="text" name="member_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->password.'"></td></tr>'; print '<tr><td>'.$langs->trans("Password").'*</td><td><input type="password" name="member_pass" size="40" value="'.$adh->password.'"></td></tr>';
print '<tr><td>'.$langs->trans("Birthday").'</td><td><input type="text" name="naiss" size="10"> ('.$langs->trans("DateFormatYYYYMMDD").')</td></tr>';
// Date naissance
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
$htmls->select_date(-1,'naiss','','',1,'add');
print "</td></tr>\n";
// Url photo
print '<tr><td>Url photo</td><td><input type="text" name="photo" size="40"></td></tr>'; print '<tr><td>Url photo</td><td><input type="text" name="photo" size="40"></td></tr>';
foreach($adho->attribute_label as $key=>$value){ foreach($adho->attribute_label as $key=>$value){
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\"></td></tr>\n"; print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\"></td></tr>\n";
@ -470,7 +640,7 @@ if ($action == 'create')
$htmls->select_date('','','','','','add'); $htmls->select_date('','','','','','add');
print "</td></tr>\n"; print "</td></tr>\n";
if (defined("ADHERENT_BANK_USE") && ADHERENT_BANK_USE) if ($conf->global->ADHERENT_BANK_USE)
{ {
print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>'; print '<tr><td>'.$langs->trans("PaymentMode").'</td><td>';
$htmls->select_types_paiements('','operation'); $htmls->select_types_paiements('','operation');
@ -498,13 +668,14 @@ if ($action == 'create')
} }
/* ************************************************************************** */ if ($rowid && $action != 'edit')
/* */
/* Edition de la fiche */
/* */
/* ************************************************************************** */
if ($rowid)
{ {
/* ************************************************************************** */
/* */
/* Mode affichage */
/* */
/* ************************************************************************** */
$adh = new Adherent($db); $adh = new Adherent($db);
$adh->id = $rowid; $adh->id = $rowid;
$adh->fetch($rowid); $adh->fetch($rowid);
@ -527,27 +698,21 @@ if ($rowid)
dolibarr_fiche_head($head, $hselected, $adh->fullname); dolibarr_fiche_head($head, $hselected, $adh->fullname);
/* // Confirmation de la suppression de l'adhérent
* Confirmation de la suppression de l'adhérent
*/
if ($action == 'delete') if ($action == 'delete')
{ {
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_delete"); $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_delete");
print '<br>'; print '<br>';
} }
/* // Confirmation de la validation
* Confirmation de la validation
*/
if ($action == 'valid') if ($action == 'valid')
{ {
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid"); $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid");
print '<br>'; print '<br>';
} }
/* // Confirmation de la Résiliation
* Confirmation de la Résiliation
*/
if ($action == 'resign') if ($action == 'resign')
{ {
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign"); $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign");
@ -622,7 +787,7 @@ if ($rowid)
if ($adh->public==1) print $langs->trans("Yes"); if ($adh->public==1) print $langs->trans("Yes");
else print $langs->trans("No"); else print $langs->trans("No");
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut($adh).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut(4).'</td></tr>';
foreach($adho->attribute_label as $key=>$value){ foreach($adho->attribute_label as $key=>$value){
print "<tr><td>$value</td><td>".$adh->array_options["options_$key"]."&nbsp;</td></tr>\n"; print "<tr><td>$value</td><td>".$adh->array_options["options_$key"]."&nbsp;</td></tr>\n";
@ -641,7 +806,7 @@ if ($rowid)
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"edit.php?rowid=$rowid\">".$langs->trans("Edit")."</a>"; print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=edit\">".$langs->trans("Edit")."</a>";
// Valider // Valider
if ($adh->statut < 1) if ($adh->statut < 1)

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -162,7 +162,7 @@ if ($result)
// Statut // Statut
print "<td>"; print "<td>";
print $adh->LibStatut($objp->statut); print $adh->LibStatut($objp->statut,2);
print "</td>"; print "</td>";
print "<td><a href=\"edit.php?rowid=$objp->rowid&action=edit\">".img_edit()."</a> &nbsp; "; print "<td><a href=\"edit.php?rowid=$objp->rowid&action=edit\">".img_edit()."</a> &nbsp; ";

View File

@ -46,7 +46,7 @@ function llxHeader($head = "") {
$menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=1&amp;filter=uptodate",$langs->trans("MenuMembersUpToDate")); $menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=1&amp;filter=uptodate",$langs->trans("MenuMembersUpToDate"));
$menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=0",$langs->trans("MenuMembersResiliated")); $menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=0",$langs->trans("MenuMembersResiliated"));
$menu->add(DOL_URL_ROOT."/public/adherents/","Espace adherents public"); $menu->add(DOL_URL_ROOT."/public/adherents/index.php?leftmenu=member_public",$langs->trans("MemberPublicLinks"));
$menu->add(DOL_URL_ROOT."/adherents/index.php",$langs->trans("Exports")); $menu->add(DOL_URL_ROOT."/adherents/index.php",$langs->trans("Exports"));
$menu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas")); $menu->add_submenu(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("Datas"));

View File

@ -38,8 +38,14 @@ $user->getrights();
if (! $user->societe_id == 0) if (! $user->societe_id == 0)
accessforbidden(); accessforbidden();
$entitytoicon=array('invoice'=>'bill','invoice_line'=>'bill'); $entitytoicon=array(
$entitytolang=array('user'=>'User','company'=>'Company','contact'=>'Contact','invoice'=>'Bill','invoice_line'=>'InvoiceLine'); 'invoice'=>'bill','invoice_line'=>'bill',
'member'=>'user', 'member_type'=>'user');
$entitytolang=array(
'user'=>'User',
'company'=>'Company','contact'=>'Contact',
'invoice'=>'Bill','invoice_line'=>'InvoiceLine',
'member'=>'Member','member_type'=>'MemberType');
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array(); $array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
$datatoexport=isset($_GET["datatoexport"])?$_GET["datatoexport"]:''; $datatoexport=isset($_GET["datatoexport"])?$_GET["datatoexport"]:'';
@ -49,7 +55,7 @@ $step=isset($_GET["step"])?$_GET["step"]:'1';
$objexport=new Export($db); $objexport=new Export($db);
$objexport->load_arrays($user,$datatoexport); $objexport->load_arrays($user,$datatoexport);
$objmodel=new ModeleExports(); $objmodelexport=new ModeleExports();
/* /*
@ -467,11 +473,11 @@ if ($step == 4 && $datatoexport)
print '<td>'.$langs->trans("LibraryVersion").'</td>'; print '<td>'.$langs->trans("LibraryVersion").'</td>';
print '</tr>'; print '</tr>';
$liste=$objmodel->liste_modeles($db); $liste=$objmodelexport->liste_modeles($db);
foreach($liste as $key) foreach($liste as $key)
{ {
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$objmodel->getDriverLabel($key).'</td><td>'.$objmodel->getLibLabel($key).'</td><td>'.$objmodel->getLibVersion($key).'</td></tr>'; print '<tr '.$bc[$var].'><td>'.$objmodelexport->getDriverLabel($key).'</td><td>'.$objmodelexport->getLibLabel($key).'</td><td>'.$objmodelexport->getLibVersion($key).'</td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -1576,12 +1576,18 @@ class Form
* Les champs sont présélectionnées avec: * Les champs sont présélectionnées avec:
* - La date set_time (timestamps ou date au format YYYY-MM-DD ou YYYY-MM-DD HH:MM) * - La date set_time (timestamps ou date au format YYYY-MM-DD ou YYYY-MM-DD HH:MM)
* - La date du jour si set_time vaut '' * - La date du jour si set_time vaut ''
* - Aucune date (champs vides) si set_time vaut -1 * - Aucune date (champs vides) si set_time vaut -1 (dans ce cas empty doit valoir 0)
* \param form_name Nom du formulaire de provenance. Utilisé pour les dates en popup style andre. * \param set_time Date de pré-sélection
* \param prefix Prefix pour nom champ
* \param h Heure
* \param m Minutes
* \param empty 0=Champ obligatoire, 1=Permet une saisie vide
* \param form_name Nom du formulaire de provenance. Utilisé pour les dates en popup style andre.
*/ */
function select_date($set_time='', $prefix='re', $h = 0, $m = 0, $empty=0,$form_name="") function select_date($set_time='', $prefix='re', $h = 0, $m = 0, $empty=0, $form_name="")
{ {
global $conf,$langs; global $conf,$langs;
if($prefix=='') $prefix='re'; if($prefix=='') $prefix='re';
if($h == '') $h=0; if($h == '') $h=0;
if($m == '') $m=0; if($m == '') $m=0;
@ -1603,7 +1609,8 @@ class Form
$strmonth[12] = $langs->trans("December"); $strmonth[12] = $langs->trans("December");
// Analyse de la date de préselection // Analyse de la date de préselection
if (eregi('^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?',$set_time,$reg)) { if (eregi('^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?',$set_time,$reg))
{
// Date au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS' // Date au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
$syear = $reg[1]; $syear = $reg[1];
$smonth = $reg[2]; $smonth = $reg[2];
@ -1611,7 +1618,8 @@ class Form
$shour = $reg[4]; $shour = $reg[4];
$smin = $reg[5]; $smin = $reg[5];
} }
elseif ($set_time) { elseif ($set_time > 0)
{
// Date est un timestamps // Date est un timestamps
$syear = date("Y", $set_time); $syear = date("Y", $set_time);
$smonth = date("n", $set_time); $smonth = date("n", $set_time);
@ -1619,8 +1627,9 @@ class Form
$shour = date("H", $set_time); $shour = date("H", $set_time);
$smin = date("i", $set_time); $smin = date("i", $set_time);
} }
else { else
// Date est vide {
// Date est vide ou vaut -1
$syear = ''; $syear = '';
$smonth = ''; $smonth = '';
$sday = ''; $sday = '';
@ -1633,16 +1642,15 @@ class Form
*/ */
if ($conf->use_javascript && $conf->use_popup_calendar && $h==0 && $m==0) if ($conf->use_javascript && $conf->use_popup_calendar && $h==0 && $m==0)
{ {
//print "e".$set_time." t ".$conf->format_date_short;
if ($set_time > 0)
{
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
}
// Calendrier popup version eldy // Calendrier popup version eldy
if ("$conf->use_popup_calendar" == "eldy") // Laissé conf->use_popup_calendar entre quote if ("$conf->use_popup_calendar" == "eldy") // Laissé conf->use_popup_calendar entre quote
{ {
//print "e".$set_time." t ".$conf->format_date_short;
if ($set_time)
{
$timearray=getDate($set_time);
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
}
// Zone de saisie manuelle de la date // Zone de saisie manuelle de la date
print '<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="11" maxlength="11" value="'.$formated_date.'"'; print '<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="11" maxlength="11" value="'.$formated_date.'"';
print ' onChange="dpChangeDay(\''.$prefix.'\',\''.$conf->format_date_short_java.'\')"'; print ' onChange="dpChangeDay(\''.$prefix.'\',\''.$conf->format_date_short_java.'\')"';
@ -1662,13 +1670,11 @@ class Form
// Calendrier popup version defaut // Calendrier popup version defaut
if ($langs->defaultlang != "") if ($langs->defaultlang != "")
{ {
print '<script language="javascript">'; print '<script language="javascript" type="text/javascript">';
print 'selectedLanguage = "'.substr($langs->defaultlang,0,2).'"'; print 'selectedLanguage = "'.substr($langs->defaultlang,0,2).'"';
print '</script>'; print '</script>';
} }
print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_calendar.js"></script>'; print '<script language="javascript" type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_calendar.js"></script>';
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
if($formated_date=="?") $formated_date="";
print '<input id="'.$prefix.'" type="text" name="'.$prefix.'" size="10" value="'.$formated_date.'"> '; print '<input id="'.$prefix.'" type="text" name="'.$prefix.'" size="10" value="'.$formated_date.'"> ';
print '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; print '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";
print '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; print '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";

View File

@ -617,7 +617,14 @@ class MenuLeft {
if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export); if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cartes/carte.php?leftmenu=export",$langs->trans("MembersCards"),1,$user->rights->adherent->export);
if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cartes/etiquette.php?leftmenu=export","Etiquettes d'adhérents",1,$user->rights->adherent->export); if ($leftmenu=="export") $newmenu->add_submenu(DOL_URL_ROOT."/adherents/cartes/etiquette.php?leftmenu=export","Etiquettes d'adhérents",1,$user->rights->adherent->export);
$newmenu->add(DOL_URL_ROOT."/public/adherents/index.php","Espace adherents public"); $newmenu->add(DOL_URL_ROOT."/public/adherents/index.php?leftmenu=member_public",$langs->trans("MemberPublicLinks"));
/*
if ($leftmenu=="member_public") $newmenu->add(DOL_URL_ROOT."/public/adherents/","Non adherent");
if ($leftmenu=="member_public") $newmenu->add_submenu("new.php","Inscription");
if ($leftmenu=="member_public") $newmenu->add(DOL_URL_ROOT."/public/adherents/","Adherents");
if ($leftmenu=="member_public") $newmenu->add_submenu("priv_edit.php",$langs->trans("EditCard"));
if ($leftmenu=="member_public") $newmenu->add_submenu("priv_liste.php",$langs->trans("List"));
*/
$newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=setup&mainmenu=members",$langs->trans("Setup"),0,$user->rights->adherent->configurer); $newmenu->add(DOL_URL_ROOT."/adherents/index.php?leftmenu=setup&mainmenu=members",$langs->trans("Setup"),0,$user->rights->adherent->configurer);
$newmenu->add_submenu(DOL_URL_ROOT."/adherents/type.php?leftmenu=setup&",$langs->trans("MembersTypes"),1,$user->rights->adherent->configurer); $newmenu->add_submenu(DOL_URL_ROOT."/adherents/type.php?leftmenu=setup&",$langs->trans("MembersTypes"),1,$user->rights->adherent->configurer);

View File

@ -71,7 +71,7 @@ class ExportExcel extends ModeleExports
// If driver use an external library, put its name here // If driver use an external library, put its name here
$this->label_lib='Php_WriteExcel'; $this->label_lib='Php_WriteExcel';
$this->version_lib='?'; $this->version_lib='0.3.0';
$this->row=0; $this->row=0;
} }

View File

@ -197,8 +197,9 @@ class modAdherent extends DolibarrModules
$r++; $r++;
$this->export_code[$r]=$this->id.'_'.$r; $this->export_code[$r]=$this->id.'_'.$r;
$this->export_label[$r]='Adhérents et attributs'; $this->export_label[$r]='Adhérents et attributs';
$this->export_fields_array[$r]=array('a.nom'=>"Lastname",'a.prenom'=>"Firstname",'a.adresse'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.email'=>"Email",'a.login'=>"Login",'a.naiss'=>"Birthday"); $this->export_fields_array[$r]=array('a.nom'=>"Lastname",'a.prenom'=>"Firstname",'a.adresse'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.email'=>"Email",'a.login'=>"Login",'a.naiss'=>"Birthday",'a.statut'=>"Satus",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.datefin'=>'DateEnd','a.tms'=>'DateLastModification','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel');
$this->export_alias_array[$r]=array('a.nom'=>"lastname",'a.prenom'=>"firstname",'a.adresse'=>"address",'a.cp'=>"zip",'a.ville'=>"town",'a.pays'=>"country",'a.email'=>"email",'a.login'=>"login",'a.naiss'=>"birthday"); $this->export_entities_array[$r]=array('a.nom'=>"member",'a.prenom'=>"member",'a.adresse'=>"member",'a.cp'=>"member",'a.ville'=>"member",'a.pays'=>"member",'a.email'=>"member",'a.login'=>"member",'a.naiss'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.datefin'=>'member','a.tms'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type');
$this->export_alias_array[$r]=array('a.nom'=>"lastname",'a.prenom'=>"firstname",'a.adresse'=>"address",'a.cp'=>"zip",'a.ville'=>"town",'a.pays'=>"country",'a.email'=>"email",'a.login'=>"login",'a.naiss'=>"birthday",'a.statut'=>"status",'a.photo'=>'photo','a.note'=>'note','a.datec'=>'datec','a.datevalid'=>'datevalid','a.datefin'=>'dateend','a.tms'=>'datem','ta.rowid'=>'type_id','ta.libelle'=>'type_label');
$this->export_sql[$r]="select "; $this->export_sql[$r]="select ";
$i=0; $i=0;
foreach ($this->export_alias_array[$r] as $key => $value) foreach ($this->export_alias_array[$r] as $key => $value)
@ -207,7 +208,7 @@ class modAdherent extends DolibarrModules
else $i++; else $i++;
$this->export_sql[$r].=$key.' as '.$value; $this->export_sql[$r].=$key.' as '.$value;
} }
$this->export_sql[$r].=' from '.MAIN_DB_PREFIX.'adherent as a'; $this->export_sql[$r].=' from '.MAIN_DB_PREFIX.'adherent as a, '.MAIN_DB_PREFIX.'adherent_type as ta WHERE a.fk_adherent_type = ta.rowid';
$this->export_permission[$r]=array(array("adherent","export")); $this->export_permission[$r]=array(array("adherent","export"));
} }

View File

@ -1,4 +1,6 @@
# Dolibarr language file - en_US - members # Dolibarr language file - en_US - members
MembersArea=Members area
PublicMembersArea=Public members area
MemberCard=Member card MemberCard=Member card
Member=Member Member=Member
Members=Members Members=Members
@ -19,9 +21,13 @@ MenuMembersResiliated=Resiliated members
DateAbonment=Subscription date DateAbonment=Subscription date
DateSubscription=Subscription date DateSubscription=Subscription date
DateNextSubscription=Next subscription DateNextSubscription=Next subscription
DateEndSubscription=Subscription end date
EndSubscription=End subscription EndSubscription=End subscription
NewMember=New member NewMember=New member
NewType=New member type NewType=New member type
MemberType=Member type
MemberTypeId=Member type id
MemberTypeLabel=Member type label
MembersTypes=Members types MembersTypes=Members types
MembersAttributes=Members attributes MembersAttributes=Members attributes
SearchAMember=Search a member SearchAMember=Search a member
@ -36,7 +42,6 @@ MembersStatusResiliated=Members resiliated
NewCotisation=New cotisation NewCotisation=New cotisation
EditMember=Edit member EditMember=Edit member
SubscriptionEndDate=Subscription end date SubscriptionEndDate=Subscription end date
MembersArea=Members area
NewAttribute=New attribut NewAttribute=New attribut
AttributeCode=Attribute code AttributeCode=Attribute code
OptionalFieldsSetup=Optional fields setup OptionalFieldsSetup=Optional fields setup
@ -65,4 +70,8 @@ ConfirmDeleteMember=Are you sure you want to delete this member (Deleting a meme
Filehtpasswd=htpasswd file Filehtpasswd=htpasswd file
ValidateMember=Validate a member ValidateMember=Validate a member
ConfirmValidateMember=Are you sure you want to validate this member ? ConfirmValidateMember=Are you sure you want to validate this member ?
FollowingLinksArePublic=Following links ares opened pages not protected by any Dolibarr permission.
PublicMemberList=Public member list
BlankSubscriptionForm=Subscription form
MemberPublicLinks=Public links/pages
ExportDataset_member_1=Members and properties ExportDataset_member_1=Members and properties

View File

@ -1,4 +1,6 @@
# Dolibarr language file - fr_FR - members # Dolibarr language file - fr_FR - members
MembersArea=Espace adhérents
PublicMembersArea=Espace public des adhérents
MemberCard=Fiche adhérent MemberCard=Fiche adhérent
Member=Adhérent Member=Adhérent
Members=Adhérents Members=Adhérents
@ -18,10 +20,14 @@ MenuMembersUpToDate=Adh
MenuMembersResiliated=Adhérents résiliés MenuMembersResiliated=Adhérents résiliés
DateAbonment=Date cotisation DateAbonment=Date cotisation
DateSubscription=Date cotisation DateSubscription=Date cotisation
DateNextSubscription=Prochaine cotisation DateNextSubscription=Date prochaine cotisation
DateEndSubscription=Date fin adhésion
EndSubscription=Fin adhésion EndSubscription=Fin adhésion
NewMember=Nouvel adhérent NewMember=Nouvel adhérent
NewType=Nouveau type d'adhérent NewType=Nouveau type d'adhérent
MemberType=Type d'adhérent
MemberTypeId=Id type adhérent
MemberTypeLabel=Libellé du type adhérent
MembersTypes=Types d'adhérents MembersTypes=Types d'adhérents
MembersAttributes=Attributs adhérents MembersAttributes=Attributs adhérents
SearchAMember=Rechercher un membre SearchAMember=Rechercher un membre
@ -36,7 +42,6 @@ MembersStatusResiliated=Adh
NewCotisation=Nouvelle adhésion NewCotisation=Nouvelle adhésion
EditMember=Édition adhérent EditMember=Édition adhérent
SubscriptionEndDate=Date de fin adhésion SubscriptionEndDate=Date de fin adhésion
MembersArea=Espace adhérents
NewAttribute=Nouvel attribut NewAttribute=Nouvel attribut
AttributeCode=Code de l'attribut AttributeCode=Code de l'attribut
OptionalFieldsSetup=Configuration des champs optionnels OptionalFieldsSetup=Configuration des champs optionnels
@ -65,4 +70,8 @@ ConfirmDeleteMember=Etes-vous s
Filehtpasswd=Fichier htpasswd Filehtpasswd=Fichier htpasswd
ValidateMember=Valider un adhérent ValidateMember=Valider un adhérent
ConfirmValidateMember=Etes-vous sûr de vouloir valider cet adhérent ? ConfirmValidateMember=Etes-vous sûr de vouloir valider cet adhérent ?
FollowingLinksArePublic=Les liens suivants sont des pages accessibles à tous et non protégées par aucune habilitation Dolibarr.
PublicMemberList=Liste des membres publiques
BlankSubscriptionForm=Formulaire inscription
MemberPublicLinks=Liens/pages publiques
ExportDataset_member_1=Adhérentes et caractéristiques ExportDataset_member_1=Adhérentes et caractéristiques

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,25 +18,48 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/**
\file htdocs/public/adherents/index.php
\ingroup member
\brief Fichier de la page de l'espace publique adherent
\author Laurent Destailleur
\version $Revision$
*/
require("./pre.inc.php"); require("./pre.inc.php");
/*
* Afffichage page
*/
llxHeader(); llxHeader();
print_titre("Gestion des adhesions a l'association"); print_fiche_titre($langs->trans("PublicMembersArea"));
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="100%" class="notopnoleft">';
print $langs->trans('FollowingLinksArePublic').'<br>';
print '<br>';
print '<table class="border" cellspacing="0" cellpadding="3">'; print '<table class="border" cellspacing="0" cellpadding="3">';
print '<tr class="liste_titre"><td colspan=2>Les menus ci-contre correspondent a:</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
print '<tr><td>-Inscription :</td><td> Formulaires d\'inscription pour les non-adherents</td></tr>'; print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td><a target="_blank" href="'.DOL_URL_ROOT.'/public/adherents/new.php'.'">'.$dolibarr_main_url_root.DOL_URL_ROOT.'/public/adherents/new.php'.'</a></td></tr>';
print '<tr><td>-Edition de sa fiche :</td><td> Permet d\'editer sa fiche d\'adherent</td></tr>'; print '<tr><td>'.$langs->trans("BlankSubscriptionEditForm").'</td><td>'.$dolibarr_main_url_root.DOL_URL_ROOT.'/public/adherents/priv_edit.php?id=xxx'.'</td></tr>';
print '<tr><td>-Liste des adherents :</td><td> Permet de voir la liste des adherents (reserve aux adherents)</td></tr>'; print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td><a target="_blank" href="'.DOL_URL_ROOT.'/public/adherents/priv_liste.php'.'">'.$dolibarr_main_url_root.DOL_URL_ROOT.'/public/adherents/priv_liste.php'.'</a></td></tr>';
print '</table>'; print '</table>';
print '</td></tr></table>';
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Jean-Louis Bergamo <jlb@j1b.org> * Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -116,7 +117,8 @@ if ($_POST["action"] == 'add')
} }
} }
llxHeader();
llxHeaderVierge();
/* ************************************************************************** */ /* ************************************************************************** */
@ -128,7 +130,8 @@ llxHeader();
// fetch optionals attributes and labels // fetch optionals attributes and labels
$adho->fetch_optionals(); $adho->fetch_optionals();
if (isset($action) && $action== 'added'){ if (isset($action) && $action== 'added')
{
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'; print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
print "<tr><td><FONT COLOR=\"blue\">Nouvel Adhérent ajouté. En attente de validation</FONT></td></tr>\n"; print "<tr><td><FONT COLOR=\"blue\">Nouvel Adhérent ajouté. En attente de validation</FONT></td></tr>\n";
print '</table>'; print '</table>';

View File

@ -37,6 +37,12 @@ function llxHeader($head = "")
$menu->add_submenu("priv_liste.php","Liste des adherents"); $menu->add_submenu("priv_liste.php","Liste des adherents");
left_menu($menu->liste); left_menu($menu->liste);
}
function llxHeaderVierge($head = "")
{
global $user, $conf, $langs;
} }

View File

@ -18,8 +18,8 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
@ -129,7 +129,7 @@ if ($action == 'update')
} }
llxHeader(); llxHeaderVierge();
if (isset($user->login)) if (isset($user->login))
{ {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,11 +19,12 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
llxHeader();
llxHeaderVierge();
if ($sortorder == "") { $sortorder="ASC"; } if ($sortorder == "") { $sortorder="ASC"; }