dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-dev] Mon patch adhérents


From: Thibaut des ABBAYES
Subject: [Dolibarr-dev] Mon patch adhérents
Date: Tue, 27 Oct 2009 00:58:33 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Bonjour,

Voici mon patch pour le module adhérents.

Il ajoute la possibilité de tableaux d'attributs.

J'ai ajouté un champ dans la table llx_adherent_options_label:
  `tablenum` int(11) NOT NULL DEFAULT '0',

Plus quelques lignes dans members.lang, que j'ai juster traduites en
français.

Cette modification permet par exmepl de stocker pour un adhérent:
- Chaque ceinture de judo et la date d'obtention
- Chaque enfant et sa date de naissance
- ...

Merci de votre feed-back, et soyez indulgents: c'est mon premier patch ;-/

tibboh

diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/.cvsignore 
me/.cvsignore
--- dolibarr-snapshot/.cvsignore        2009-10-19 05:00:10.000000000 +0200
+++ me/.cvsignore       1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-index.php
-*.htaccess
-*.settings
-*.buildpath
-*.project
-*.cache
-*.log
-*.DS_Store
-document
-documents
-DEBIAN
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/adherent.class.php 
me/htdocs/adherents/adherent.class.php
--- dolibarr-snapshot/htdocs/adherents/adherent.class.php       2009-10-22 
03:05:22.000000000 +0200
+++ me/htdocs/adherents/adherent.class.php      2009-10-18 21:27:37.000000000 
+0200
@@ -21,10 +21,15 @@
  */
 
 /**
- *     \file       htdocs/adherents/adherent.class.php
- *     \ingroup    member
- *     \brief      Fichier de la classe permettant la gestion d'un adherent
- *     \version    $Id: adherent.class.php,v 1.143 2009/10/20 14:22:24 hregis 
Exp $
+ \file       htdocs/adherents/adherent.class.php
+ \ingroup    adherent
+ \brief      Fichier de la classe permettant la gestion d'un adherent
+ \author     Rodolphe Qiedeville
+ \author           Jean-Louis Bergamo
+ \author           Laurent Destailleur
+ \author     Sebastien Di Cintio
+ \author     Benoit Mortier
+ \version    $Id: adherent.class.php,v 1.129 2009/04/20 15:30:38 eldy Exp $
  */
 
 require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
@@ -36,6 +41,7 @@
  *      \class      Adherent
  *             \brief      Classe permettant la gestion d'un adherent
  */
+
 class Adherent extends CommonObject
 {
        var $db;
@@ -52,6 +58,7 @@
        var $login;
        var $pass;
        var $societe;
+       var $fk_soc;
        var $adresse;
        var $cp;
        var $ville;
@@ -83,24 +90,22 @@
        var $user_id;
        var $user_login;
 
-       var $fk_soc;
-
        // Fields loaded by fetch_subscriptions()
        var $fistsubscription_date;
        var $fistsubscription_amount;
        var $lastsubscription_date;
        var $lastsubscription_amount;
-       var $subscriptions=array();
 
        //  var $public;
        var $array_options;
+       var $array_options_table;
 
-       var $oldcopy;           // To contains a clone of this when we need to 
save old properties of object
 
 
        /**
-        *      \brief Adherent
-        *      \param DB               base de donnees
+        \brief Adherent
+        \param DB              base de donnees
+        \param id              id de l'adherent
         */
        function Adherent($DB)
        {
@@ -292,30 +297,13 @@
                                $this->id=$id;
 
                                // Update minor fields
-                               $result=$this->update($user,1,1); // nosync is 
1 to avoid update data of user
+                               $result=$this->update($user,1,1);
                                if ($result < 0)
                                {
                                        $this->db->rollback();
                                        return -1;
                                }
 
-                               // Add link to user
-                               if ($this->user_id)
-                               {
-                                       // Add link to user
-                                       $sql = "UPDATE ".MAIN_DB_PREFIX."user 
SET";
-                                       $sql.= " fk_member = '".$this->id."'";
-                                       $sql.= " WHERE rowid = ".$this->user_id;
-                                       dol_syslog("Adherent::create 
sql=".$sql);
-                                       $resql = $this->db->query($sql);
-                                       if (! $resql)
-                                       {
-                                               $this->error='Failed to update 
user to make link with member';
-                                               $this->db->rollback();
-                                               return -4;
-                                       }
-                               }
-
                                
$this->use_webcal=($conf->global->PHPWEBCALENDAR_MEMBERSTATUS=='always'?1:0);
 
                                if (! $notrigger)
@@ -359,21 +347,20 @@
 
 
        /**
-        *      \brief          Update a member in database (standard 
information and password)
+        *      \brief          Fonction qui met a jour l'adherent (sauf mot de 
passe)
         *      \param          user                    User making update
-        *      \param          notrigger               1=disable trigger 
UPDATE (when called by create)
-        *      \param          nosyncuser              0=Synchronize linked 
user (standard info), 1=Do not synchronize linked user
-        *      \param          nosyncuserpass  0=Synchronize linked user 
(password), 1=Do not synchronize linked user
-        *      \return         int                             <0 si KO, >0 si 
OK
+        *      \param          notrigger               1=desactive le trigger 
UPDATE (quand appele par creation)
+        *      \param          nosyncuser              Do not synchronize 
linked user
+        *      \return         int                             <0 si KO, >0 si 
OK
         */
-       function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0)
+       function update($user,$notrigger=0,$nosyncuser=0)
        {
                global $conf, $langs;
 
                $nbrowsaffected=0;
                $error=0;
 
-               dol_syslog("Adherent::update notrigger=".$notrigger.", 
nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass.", 
email=".$this->email);
+               dol_syslog("Adherent::update notrigger=".$notrigger.", 
nosyncuser=".$nosyncuser.", email=".$this->email);
 
                // Verification parametres
                if ($conf->global->ADHERENT_MAIL_REQUIRED && ! 
isValidEMail($this->email))
@@ -410,8 +397,6 @@
                $sql.= ", fk_user_mod=".($user->id>0?$user->id:'null'); // Can 
be null because member can be create by a guest
                $sql.= " WHERE rowid = ".$this->id;
 
-               dol_syslog("Adherent::update UPDATE MEMBER");
-
                dol_syslog("Adherent::update sql=".$sql);
                $resql = $this->db->query($sql);
                if ($resql)
@@ -460,41 +445,24 @@
                                }
                        }
 
-                       // Update password
+                       // Mise a jour mot de passe
                        if ($this->pass)
                        {
-                               dol_syslog("Adherent::update UPDATE PASSWORD");
                                if ($this->pass != $this->pass_indatabase && 
$this->pass != $this->pass_indatabase_crypted)
                                {
                                        // Si mot de passe saisi et different 
de celui en base
-                                       
$result=$this->setPassword($user,$this->pass,0,$notrigger,$nosyncuserpass);
+                                       
$result=$this->setPassword($user,$this->pass,0,$notrigger);
+
                                        if (! $nbrowsaffected) 
$nbrowsaffected++;
                                }
                        }
 
-                       // Remove link to user
-                       dol_syslog("Adherent::update UPDATE LINK TO USER");
-                       $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = 
NULL where fk_member = ".$this->id;
-                       dol_syslog("Adherent::update sql=".$sql, LOG_DEBUG);
-                       $resql = $this->db->query($sql);
-                       if (! $resql) { $this->error=$this->db->error(); 
$this->db->rollback(); return -5; }
-                       // If there is a user linked to this member
-                       if ($this->user_id > 0)
+                       if ($nbrowsaffected)
                        {
-                               $sql = "UPDATE ".MAIN_DB_PREFIX."user SET 
fk_member = ".$this->id." where rowid = ".$this->user_id;
-                               dol_syslog("Adherent::update sql=".$sql, 
LOG_DEBUG);
-                               $resql = $this->db->query($sql);
-                               if (! $resql) { 
$this->error=$this->db->error(); $this->db->rollback(); return -5; }
-                       }
-
-                       if ($nbrowsaffected)    // If something has change in 
data
-                       {
-                               if ($this->user_id > 0 && ! $nosyncuser)
+                               if ($this->user_id && ! $nosyncuser)
                                {
                                        
require_once(DOL_DOCUMENT_ROOT."/user.class.php");
 
-                                       dol_syslog("Adherent::update UPDATE 
LINKED USER");
-
                                        // This member is linked with a user, 
so we also update users informations
                                        // if this is an update.
                                        $luser=new User($this->db);
@@ -517,7 +485,7 @@
 
                                                $luser->fk_member=$this->id;
 
-                                               
$result=$luser->update($user,0,1,1);    // Use nosync to 1 to avoid cyclic 
updates
+                                               
$result=$luser->update($user,0,1);
                                                if ($result < 0)
                                                {
                                                        
$this->error=$luser->error;
@@ -699,7 +667,7 @@
 
 
        /**
-        *    \brief     Change password of a user
+        *    \brief     Change le mot de passe d'un utilisateur
         *    \param     user             Object user de l'utilisateur qui fait 
la modification
         *    \param     password         Nouveau mot de passe (e generer si 
non communique)
         *    \param     isencrypted      0 ou 1 si il faut crypter le mot de 
passe en base (0 par defaut)
@@ -713,7 +681,7 @@
 
                $error=0;
 
-               dol_syslog("Adherent::Password user=".$user->id." 
password=".preg_replace('/./i','*',$password)." isencrypted=".$isencrypted);
+               dol_syslog("Adherent::Password user=".$user->id." 
password=".eregi_replace('.','*',$password)." isencrypted=".$isencrypted);
 
                // Si nouveau mot de passe non communique, on genere par module
                if (! $password)
@@ -744,7 +712,7 @@
                $result = $this->db->query($sql);
                if ($result)
                {
-                       $nbaffectedrows=$this->db->affected_rows($result);
+                       $nbaffectedrows=$this->db->affected_rows();
 
                        if ($nbaffectedrows)
                        {
@@ -804,79 +772,6 @@
 
 
        /**
-        *    \brief     Set link to a user
-        *    \param     userid                 Id of user to link to
-        *    \return    int                            1=OK, -1=KO
-        */
-       function setUserId($userid)
-       {
-               global $conf, $langs;
-
-               $this->db->begin();
-
-               // If user is linked to this member, remove old link to this 
member
-               $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL 
where fk_member = ".$this->id;
-               dol_syslog("Adherent::setUserId sql=".$sql, LOG_DEBUG);
-               $resql = $this->db->query($sql);
-               if (! $resql) { $this->error=$this->db->error(); 
$this->db->rollback(); return -1; }
-
-               // Set link to user
-               if ($userid > 0)
-               {
-                       $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = 
".$this->id;
-                       $sql.= " WHERE rowid = ".$userid;
-                       dol_syslog("Adherent::setUserId sql=".$sql, LOG_DEBUG);
-                       $resql = $this->db->query($sql);
-                       if (! $resql) { $this->error=$this->db->error(); 
$this->db->rollback(); return -2; }
-               }
-
-               $this->db->commit();
-
-               return 1;
-       }
-
-
-       /**
-        *    \brief     Set link to a third party
-        *    \param     userid                 Id of user to link to
-        *    \return    int                            1=OK, -1=KO
-        */
-       function setThirdPartyId($thirdpartyid)
-       {
-               global $conf, $langs;
-
-               $this->db->begin();
-
-               // Update link to third party
-               if ($thirdpartyid > 0)
-               {
-                       $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = 
null where fk_soc = '".$thirdpartyid."'";
-                       dol_syslog("Adherent::setThirdPartyId sql=".$sql);
-                       $resql = $this->db->query($sql);
-               }
-
-               // Update link to third party
-               $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = 
".($thirdpartyid>0 ? $thirdpartyid : 'null');
-               $sql.= " WHERE rowid = ".$this->id;
-
-               dol_syslog("Adherent::setThirdPartyId sql=".$sql);
-               $resql = $this->db->query($sql);
-               if ($resql)
-               {
-                       $this->db->commit();
-                       return 1;
-               }
-               else
-               {
-                       $this->error=$this->db->error();
-                       dol_syslog("Adherent::setThirdPartyId ".$this->error, 
LOG_ERR);
-                       $this->db->rollback();
-                       return -1;
-               }
-       }
-
-
-       /**
         *              \brief      Fonction qui recupere l'adherent depuis son 
login
         *              \param      login               login de l'adherent
         */
@@ -903,12 +798,11 @@
 
        /**
         *      \brief          Load member from database
-        *      \param      rowid       Id of object to load
-        *      \param          ref                     To load member from its 
ref
-        *      \param          fk_soc          To load member from its link to 
third party
-        *      \return     int         >0 if OK, 0 if not found, <0 if KO
+        *      \param      rowid       id of object to load
+        *      \param          ref                     Ref of invoice
+        *      \return     int         >0 if OK, <0 if KO
         */
-       function fetch($rowid,$ref='',$fk_soc='')
+       function fetch($rowid,$ref='')
        {
                global $langs;
 
@@ -929,7 +823,6 @@
                $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = 
u.fk_member";
                $sql.= " WHERE d.fk_adherent_type = t.rowid";
                if ($ref) $sql.= " AND d.rowid='".$ref."'";
-               elseif ($fk_soc) $sql.= " AND d.fk_soc='".$fk_soc."'";
                else $sql.= " AND d.rowid=".$rowid;
                dol_syslog("Adherent::fetch sql=".$sql);
 
@@ -989,7 +882,7 @@
                        }
                        else
                        {
-                               return 0;
+                               return -1;
                        }
                }
                else
@@ -1013,10 +906,9 @@
                global $langs;
 
                $sql = "SELECT c.rowid, c.fk_adherent, c.cotisation, c.note, 
c.fk_bank,";
-               $sql.= " c.tms as datem,";
-               $sql.= " c.datec as datec,";
-               $sql.= " c.dateadh as dateadh,";
-               $sql.= " c.datef as datef";
+               $sql.= " ".$this->db->pdate("c.tms")." as datem,";
+               $sql.= " ".$this->db->pdate("c.datec")." as datec,";
+               $sql.= " ".$this->db->pdate("c.dateadh")." as dateadh";
                $sql.= " FROM ".MAIN_DB_PREFIX."cotisation as c";
                $sql.= " WHERE c.fk_adherent = ".$this->id;
                $sql.= " ORDER BY c.dateadh";
@@ -1025,8 +917,6 @@
                $resql=$this->db->query($sql);
                if ($resql)
                {
-                       $this->subscriptions=array();
-
                        $i=0;
                        while ($obj = $this->db->fetch_object($resql))
                        {
@@ -1038,18 +928,7 @@
                                $this->lastsubscription_date=$obj->dateadh;
                                $this->lastsubscription_amount=$obj->cotisation;
 
-                               $subscription=new Cotisation($this->db);
-                               $subscription->id=$obj->rowid;
-                               $subscription->fk_adherent=$obj->fk_adherent;
-                               $subscription->amount=$obj->cotisation;
-                               $subscription->note=$obj->note;
-                               $subscription->fk_bank=$obj->fk_bank;
-                               
$subscription->datem=$this->db->jdate($obj->datem);
-                               
$subscription->datec=$this->db->jdate($obj->datec);
-                               
$subscription->dateadh=$this->db->jdate($obj->dateadh);
-                               
$subscription->datef=$this->db->jdate($obj->datef);
-
-                               $this->subscriptions[]=$subscription;
+                               // TODO Add also array of subscription records
 
                                $i++;
                        }
@@ -1736,7 +1615,7 @@
                        {
                                if (! $date_end_subscription)            return 
$langs->trans("MemberStatusActive");
                                elseif ($date_end_subscription < time()) return 
$langs->trans("MemberStatusActiveLate");
-                               else                                     return 
$langs->trans("MemberStatusPaid");
+                               else                                     return 
$langs->trans("MemberStatusPayed");
                        }
                        if ($statut == 0)  return 
$langs->trans("MemberStatusResiliated");
                }
@@ -1747,7 +1626,7 @@
                        {
                                if (! $date_end_subscription)            return 
$langs->trans("MemberStatusActiveShort");
                                elseif ($date_end_subscription < time()) return 
$langs->trans("MemberStatusActiveLateShort");
-                               else                                     return 
$langs->trans("MemberStatusPaidShort");
+                               else                                     return 
$langs->trans("MemberStatusPayedShort");
                        }
                        if ($statut == 0)  return 
$langs->trans("MemberStatusResiliatedShort");
                }
@@ -1758,7 +1637,7 @@
                        {
                                if (! $date_end_subscription)            return 
img_picto($langs->trans('MemberStatusActive'),'statut1').' 
'.$langs->trans("MemberStatusActiveShort");
                                elseif ($date_end_subscription < time()) return 
img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' 
'.$langs->trans("MemberStatusActiveLateShort");
-                               else                                     return 
img_picto($langs->trans('MemberStatusPaid'),'statut4').' 
'.$langs->trans("MemberStatusPaidShort");
+                               else                                     return 
img_picto($langs->trans('MemberStatusPayed'),'statut4').' 
'.$langs->trans("MemberStatusPayedShort");
                        }
                        if ($statut == 0)  return 
img_picto($langs->trans('MemberStatusResiliated'),'statut5').' 
'.$langs->trans("MemberStatusResiliatedShort");
                }
@@ -1769,7 +1648,7 @@
                        {
                                if (! $date_end_subscription)            return 
img_picto($langs->trans('MemberStatusActive'),'statut1');
                                elseif ($date_end_subscription < time()) return 
img_picto($langs->trans('MemberStatusActiveLate'),'statut3');
-                               else                                     return 
img_picto($langs->trans('MemberStatusPaid'),'statut4');
+                               else                                     return 
img_picto($langs->trans('MemberStatusPayed'),'statut4');
                        }
                        if ($statut == 0)  return 
img_picto($langs->trans('MemberStatusResiliated'),'statut5');
                }
@@ -1780,7 +1659,7 @@
                        {
                                if (! $date_end_subscription)            return 
img_picto($langs->trans('MemberStatusActive'),'statut1').' 
'.$langs->trans("MemberStatusActive");
                                elseif ($date_end_subscription < time()) return 
img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' 
'.$langs->trans("MemberStatusActiveLate");
-                               else                                     return 
img_picto($langs->trans('MemberStatusPaid'),'statut4').' 
'.$langs->trans("MemberStatusPaid");
+                               else                                     return 
img_picto($langs->trans('MemberStatusPayed'),'statut4').' 
'.$langs->trans("MemberStatusPayed");
                        }
                        if ($statut == 0)  return 
img_picto($langs->trans('MemberStatusResiliated'),'statut5').' 
'.$langs->trans("MemberStatusResiliated");
                }
@@ -1791,7 +1670,7 @@
                        {
                                if (! $date_end_subscription)            return 
$langs->trans("MemberStatusActive").' 
'.img_picto($langs->trans('MemberStatusActive'),'statut1');
                                elseif ($date_end_subscription < time()) return 
$langs->trans("MemberStatusActiveLate").' 
'.img_picto($langs->trans('MemberStatusActiveLate'),'statut3');
-                               else                                     return 
$langs->trans("MemberStatusPaid").' 
'.img_picto($langs->trans('MemberStatusPaid'),'statut4');
+                               else                                     return 
$langs->trans("MemberStatusPayed").' 
'.img_picto($langs->trans('MemberStatusPayed'),'statut4');
                        }
                        if ($statut == 0)  return 
$langs->trans("MemberStatusResiliated").' 
'.img_picto($langs->trans('MemberStatusResiliated'),'statut5');
                }
@@ -1843,11 +1722,9 @@
                if ($user->societe_id) return -1;   // protection pour eviter 
appel par utilisateur externe
 
                $this->nbtodo=$this->nbtodolate=0;
-
                $sql = "SELECT a.rowid, a.datefin";
                $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
                $sql.= " WHERE a.statut=1";
-
                $resql=$this->db->query($sql);
                if ($resql)
                {
@@ -1917,8 +1794,8 @@
        /**
         *      \brief          Retourne chaine DN complete dans l'annuaire 
LDAP pour l'objet
         *      \param          info            Info string loaded by 
_load_ldap_info
-        *      \param          mode            0=Return full DN 
(uid=qqq,ou=xxx,dc=aaa,dc=bbb)
-        *                                                      1=Return DN 
without key inside (ou=xxx,dc=aaa,dc=bbb)
+        *      \param          mode            0=Return DN without key inside 
(ou=xxx,dc=aaa,dc=bbb)
+        *                                                      1=Return full 
DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb)
         *                                                      2=Return key 
only (uid=qqq)
         *      \return         string          DN
         */
@@ -1944,26 +1821,26 @@
                $info=array();
 
                // Object classes
-               
$info["objectclass"]=explode(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS);
+               
$info["objectclass"]=split(',',$conf->global->LDAP_MEMBER_OBJECT_CLASS);
 
                // Member
-               if ($this->fullname  && 
$conf->global->LDAP_MEMBER_FIELD_FULLNAME) 
$info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname;
-               if ($this->nom && $conf->global->LDAP_MEMBER_FIELD_NAME)        
 $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->nom;
-               if ($this->prenom && 
$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME) 
$info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->prenom;
-               if ($this->login && $conf->global->LDAP_MEMBER_FIELD_LOGIN)     
 $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login;
-               if ($this->pass && $conf->global->LDAP_MEMBER_FIELD_PASSWORD)   
 $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass;        // 
this->pass = mot de passe non crypte
-               if ($this->poste && $conf->global->LDAP_MEMBER_FIELD_TITLE)     
 $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
-               if ($this->adresse && $conf->global->LDAP_MEMBER_FIELD_ADDRESS) 
 $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->adresse;
-               if ($this->cp && $conf->global->LDAP_MEMBER_FIELD_ZIP)          
 $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->cp;
-               if ($this->ville && $conf->global->LDAP_MEMBER_FIELD_TOWN)      
 $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->ville;
-               if ($this->pays_code && 
$conf->global->LDAP_MEMBER_FIELD_COUNTRY)     
$info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->pays_code;
-               if ($this->email && $conf->global->LDAP_MEMBER_FIELD_MAIL)      
 $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
-               if ($this->phone && $conf->global->LDAP_MEMBER_FIELD_PHONE)     
 $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
-               if ($this->phone_perso && 
$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO) 
$info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
-               if ($this->phone_mobile && 
$conf->global->LDAP_MEMBER_FIELD_MOBILE) 
$info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
-               if ($this->fax && $conf->global->LDAP_MEMBER_FIELD_FAX)       
$info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
-               if ($this->note && 
$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION) 
$info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note;
-               if ($this->naiss && $conf->global->LDAP_MEMBER_FIELD_BIRTHDATE) 
 $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = 
dol_print_date($this->naiss,'dayhourldap');
+               if ($this->fullname  && $conf->global->LDAP_FIELD_FULLNAME) 
$info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
+               if ($this->nom && $conf->global->LDAP_FIELD_NAME)         
$info[$conf->global->LDAP_FIELD_NAME] = $this->nom;
+               if ($this->prenom && $conf->global->LDAP_FIELD_FIRSTNAME) 
$info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->prenom;
+               if ($this->login && $conf->global->LDAP_FIELD_LOGIN)      
$info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
+               if ($this->pass && $conf->global->LDAP_FIELD_PASSWORD)    
$info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass;      // this->pass = 
mot de passe non crypte
+               if ($this->poste && $conf->global->LDAP_FIELD_TITLE)      
$info[$conf->global->LDAP_FIELD_TITLE] = $this->poste;
+               if ($this->adresse && $conf->global->LDAP_FIELD_ADDRESS)  
$info[$conf->global->LDAP_FIELD_ADDRESS] = $this->adresse;
+               if ($this->cp && $conf->global->LDAP_FIELD_ZIP)           
$info[$conf->global->LDAP_FIELD_ZIP] = $this->cp;
+               if ($this->ville && $conf->global->LDAP_FIELD_TOWN)       
$info[$conf->global->LDAP_FIELD_TOWN] = $this->ville;
+               if ($this->pays && $conf->global->LDAP_FIELD_COUNTRY)     
$info[$conf->global->LDAP_FIELD_COUNTRY] = $this->pays;
+               if ($this->email && $conf->global->LDAP_FIELD_MAIL)       
$info[$conf->global->LDAP_FIELD_MAIL] = $this->email;
+               if ($this->phone && $conf->global->LDAP_FIELD_PHONE)      
$info[$conf->global->LDAP_FIELD_PHONE] = $this->phone;
+               if ($this->phone_perso && 
$conf->global->LDAP_FIELD_PHONE_PERSO) 
$info[$conf->global->LDAP_FIELD_PHONE_PERSO] = $this->phone_perso;
+               if ($this->phone_mobile && $conf->global->LDAP_FIELD_MOBILE) 
$info[$conf->global->LDAP_FIELD_MOBILE] = $this->phone_mobile;
+               if ($this->fax && $conf->global->LDAP_FIELD_FAX)              
$info[$conf->global->LDAP_FIELD_FAX] = $this->fax;
+               if ($this->note && $conf->global->LDAP_FIELD_DESCRIPTION) 
$info[$conf->global->LDAP_FIELD_DESCRIPTION] = $this->note;
+               if ($this->naiss && $conf->global->LDAP_FIELD_BIRTHDATE)  
$info[$conf->global->LDAP_FIELD_BIRTHDATE] = 
dol_print_date($this->naiss,'dayhourldap');
                if (isset($this->statut) && 
$conf->global->LDAP_FIELD_MEMBER_STATUS)  
$info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
                if ($this->datefin && 
$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)  
$info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = 
dol_print_date($this->datefin,'dayhourldap');
 
@@ -2033,5 +1910,59 @@
                }
        }
 
+
+       /**
+        \brief AdherentPlus
+        \param DB              base de donnees
+        \param id              id de l'adherent
+        */
+       function AdherentPlus($DB)
+       {
+               $this->db = $DB ;
+               $this->statut = -1;
+               // l'adherent n'est pas public par defaut
+               $this->public = 0;
+               // les champs optionnels sont vides
+               $this->array_options=array();
+               $this->array_options_table = array();
+       }
+
+
+       /**
+        *      \brief      Fonction qui recupere les donnees optionelles de 
l'adherent en tableau
+        *      \param      rowid, tablenum
+        */
+       function fetch_optionals_array($rowid, $tablenum)
+       {
+               $this->array_options_table[$tablenum]=array();
+               $sql = "SELECT *";              // \TODO Should not use this 
syntax
+               $sql.= " FROM ".MAIN_DB_PREFIX."adherent_options_".$tablenum;
+               $sql.= " WHERE adhid=".$rowid;
+               $sql.= " ORDER BY linenum";
+
+               dol_syslog("AdherentPlus::fetch_optionals_array sql=".$sql, 
LOG_DEBUG);
+               $result=$this->db->query($sql);
+               if ($result)
+               {
+                       if ($this->db->num_rows($result))
+                       {
+                               while($tmp_tab = 
$this->db->fetch_array($result)) {
+                    foreach ($tmp_tab as $key => $value)
+                    {
+                        if ($key != 'tms' && $key != 'adhid' && $key != 
'linenum' && !is_numeric($key))
+                        {
+                            // we can add this attribute to adherent object
+                            
$this->array_options_table[$tablenum][$tmp_tab['linenum']][$key]=$value;
+                        }
+                    }
+                }
+                return($this->array_options_table[$tablenum]);
+                       }
+               }
+               else
+               {
+                       dol_print_error($this->db);
+               }
+       }
 }
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/adherent_options.class.php 
me/htdocs/adherents/adherent_options.class.php
--- dolibarr-snapshot/htdocs/adherents/adherent_options.class.php       
2009-10-10 18:07:01.000000000 +0200
+++ me/htdocs/adherents/adherent_options.class.php      2009-10-27 
00:38:05.000000000 +0100
@@ -2,7 +2,7 @@
 /* Copyright (C) 2002-2003 Rodolphe Quiedeville <address@hidden>
  * Copyright (C) 2002-2003 Jean-Louis Bergamo   <address@hidden>
  * Copyright (C) 2004      Sebastien Di Cintio  <address@hidden>
- * Copyright (C) 2004      Benoit Mortier          <address@hidden>
+ * Copyright (C) 2004      Benoit Mortier                        
<address@hidden>
  *
  * 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
@@ -21,9 +21,13 @@
 
 /**
  *     \file           htdocs/adherents/adherent_options.class.php
- *     \ingroup    member
+ *     \ingroup    adherent
  *     \brief      Fichier de la classe de gestion de la table des champs 
optionels adherents
- *     \version    $Id: adherent_options.class.php,v 1.22 2009/10/10 16:00:38 
eldy Exp $
+ *     \author     Rodolphe Quiedville
+ *     \author     Jean-Louis Bergamo
+ *     \author     Sebastien Di Cintio
+ *     \author     Benoit Mortier
+ *     \version    $Id: adherent_options.class.php,v 1.21 2009/02/20 22:53:24 
eldy Exp $
  */
 
 /**
@@ -34,17 +38,17 @@
 {
        var $id;
        var $db;
+
        /*
-        * Tableau contenant le nom des champs en clef et la definition de
-        * ces champs
-        */
-       var $attribute_name;
-       /*
-        * Tableau contenant le nom des champs en clef et le label de ces
+        * Tableau contenant la définition des options
+        * Clef: nom du champ
+        * Value array(
+        *      'label'   : label du champ (ex val de attribute_label)
+        *  'type'    : type du champ (ex val de attribute_name)
+        *  'tablenum': numero de la table d'option (0 ou void si pas en 
tableau)
         * champs en value
         */
-       var $attribute_label;
-
+       var $attribute_definition;
        var $error;
        /*
         * Constructor
@@ -62,8 +66,7 @@
                $this->db = $DB ;
                $this->id = $id;
                $this->error = array();
-               $this->attribute_name = array();
-               $this->attribute_label = array();
+               $this->attribute_definition = array();
        }
 
        /*!
@@ -126,14 +129,19 @@
 
                \remarks        Ceci correspond a une modification de la table 
et pas a un rajout d'enregistrement
                */
-       function create($attrname,$type='varchar',$length=255) {
+       function create($attrname,$type='varchar',$length=255,$tablenum=0) {
+
+               if ($tablenum == 0)
+                       $nom_table = MAIN_DB_PREFIX.'adherent_options';
+               else
+                       $nom_table = 
MAIN_DB_PREFIX.'adherent_options_'.trim($tablenum);
 
                if (isset($attrname) && $attrname != '' && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
                {
-                       $sql = "ALTER TABLE ".MAIN_DB_PREFIX."adherent_options 
";
+                       $sql = "ALTER TABLE $nom_table ";
                        switch ($type){
                                case 'varchar' :
-                               case 'interger' :
+                               case 'int' :
                                        $sql .= " ADD $attrname $type($length)";
                                        break;
                                case 'text' :
@@ -162,11 +170,47 @@
        }
 
        /**
+        *      \brief  Fonction qui cree une table d'attribut
+        *      \param  attrname                        nom de l'atribut
+        *      \param  label                           nom du label
+        */
+       function create_attrtable($attrname)
+       {
+               // Cherche le dernier numéro de table utilisé
+               $tbls = fetch_optionals_table(1);
+               for ($x=1;array_key_exists($x,$tbls);$x++);
+
+               $rs = 
$this->create_label('TABLE'.trim($x),$attrname,'table',$x,0,$x);
+        if ($rs) $nom_table=MAIN_DB_PREFIX.'adherent_options_'.trim($x);
+
+               // Cherche si la table existe
+               //$sql = "show tables like '$nom_table'";
+
+               //$rtbl=$this->db->query($sql);
+               //if (($rtbl) && ($this->db->num_rows($rcont))==0) {
+                       // La table n'a pas été trouvée, crée la.
+                       $sql = "CREATE TABLE $nom_table (";
+                       $sql .= '  adhid int(11) NOT NULL,';
+                       $sql .= '  linenum int(11) NOT NULL auto_increment,';
+                       $sql .= '  tms timestamp NOT NULL default 
CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,';
+                       $sql .= '  PRIMARY KEY  (adhid,linenum))';
+
+                       if (!$this->db->query($sql))
+                       {
+                               dol_print_error($this->db);
+                               return 0;
+                       } else {
+                               return 1;
+                       }
+               //}
+       }
+
+       /**
         *      \brief  Fonction qui cree un label
         *      \param  attrname                        nom de l'atribut
         *      \param  label                           nom du label
         */
-       function create_label($attrname,$label='',$type='',$pos=0,$size=0)
+       function 
create_label($attrname,$label='',$type='',$pos=0,$size=0,$table=0)
        {
                // Clean parameters
                if (empty($pos)) $pos=0;
@@ -176,7 +220,7 @@
                {
                        $sql = "INSERT INTO 
".MAIN_DB_PREFIX."adherent_options_label SET ";
                        $sql .= " name='$attrname', 
label='".addslashes($label)."',";
-                       $sql .= " type='".$type."', pos='".$pos."', 
size='".$size."'";
+                       $sql .= " type='".$type."', pos='".$pos."', 
size='".$size."', tablenum=".$table;
 
                        dol_syslog("AdherentOptions::create_label sql=".$sql);
                        if ($this->db->query($sql))
@@ -197,26 +241,49 @@
         */
        function delete($attrname)
        {
-               if (isset($attrname) && $attrname != '' && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
+               // Cherche les infos détaillées sur cette option
+               $this->fetch_name_optionals_def();
+               $opt = $this->attribute_definition[$attrname];
+               if ($opt['tablenum'] == 0)
+                       $nom_table = MAIN_DB_PREFIX.'adherent_options';
+               else
+                       $nom_table = 
MAIN_DB_PREFIX.'adherent_options_'.trim($opt['tablenum']);
+
+               $result=$this->db->DDLDropField($nom_table,$attrname);
+               if ($result < 0)
                {
-                       
$result=$this->db->DDLDropField(MAIN_DB_PREFIX."adherent_options",$attrname);
-                       if ($result < 0)
-                       {
-                               $this->error=$this->db->lasterror();
-                               dol_syslog("AdherentOption::delete 
".$this->error, LOG_ERR);
-                       }
+                       $this->error=$this->db->lasterror();
+                       dol_syslog("AdherentOption::delete ".$this->error, 
LOG_ERR);
+               }
 
-                       $result=$this->delete_label($attrname);
+               $result=$this->delete_label($attrname);
 
-                       return $result;
-               }
-               else
-               {
+               return $result;
+       }
+
+       function drop_table($tablenum)
+       {
+               $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'adherent_options_label 
WHERE tablenum = '.$tablenum;
+               if ($this->db->query( $sql)) {
+                       $sql = 'DROP TABLE 
'.MAIN_DB_PREFIX.'adherent_options_'.$tablenum;
+                       if ($this->db->query( $sql)) {
+                               return 1;
+                       } else {
+                               print dol_print_error($this->db);
+                               return 0;
+                       }
+               } else {
+                       print dol_print_error($this->db);
                        return 0;
                }
+       }
 
+       function update_table($tablenum, $label)
+       {
+               $this->update_label('TABLE'.$tablenum, $label, 'table', 0);
        }
 
+
        /**
         *      \brief  Fonction qui supprime un label
         *      \param  attrname                        nom du label
@@ -249,37 +316,40 @@
                */
        function update($attrname,$type='varchar',$length=255)
        {
-               if (isset($attrname) && $attrname != '' && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)){
-                       $sql = "ALTER TABLE ".MAIN_DB_PREFIX."adherent_options 
";
-                       switch ($type){
-                               case 'varchar' :
-                               case 'interger' :
-                                       $sql .= " MODIFY COLUMN $attrname 
$type($length)";
-                                       break;
-                               case 'text' :
-                               case 'date' :
-                               case 'datetime' :
-                                       $sql .= " MODIFY COLUMN $attrname 
$type";
-                                       break;
-                               default:
-                                       $sql .= " MODIFY COLUMN $attrname 
$type";
-                                       break;
-                       }
-                       //$sql .= "MODIFY COLUMN $attrname $type($length)";
+               // Cherche les infos détaillées sur cette option
+               $this->fetch_name_optionals_def();
+               $opt = $this->attribute_definition[$attrname];
+               if ($opt['tablenum'] == 0)
+                       $nom_table = MAIN_DB_PREFIX.'adherent_options';
+               else
+                       $nom_table = 
MAIN_DB_PREFIX.'adherent_options_'.trim($opt['tablenum']);
 
-                       if ( $this->db->query( $sql) )
-                       {
-                               return 1;
-                       }
-                       else
-                       {
-                               print dol_print_error($this->db);
-                               return 0;
-                       }
-               }else{
-                       return 0;
+               $sql = "ALTER TABLE $nom_table ";
+               switch ($type){
+                       case 'varchar' :
+                       case 'int' :
+                               $sql .= " MODIFY COLUMN $attrname 
$type($length)";
+                               break;
+                       case 'text' :
+                       case 'date' :
+                       case 'datetime' :
+                               $sql .= " MODIFY COLUMN $attrname $type";
+                               break;
+                       default:
+                               $sql .= " MODIFY COLUMN $attrname $type";
+                               break;
                }
+               //$sql .= "MODIFY COLUMN $attrname $type($length)";
 
+               if ( $this->db->query( $sql) )
+               {
+                       return 1;
+               }
+               else
+               {
+                       print dol_print_error($this->db);
+                       return 0;
+               }
        }
 
        /*!
@@ -288,22 +358,17 @@
                \param  label                                   nom du label
                */
 
-       function update_label($attrname,$label='')
+       function update_label($attrname,$label,$type, $size)
        {
                if (isset($attrname) && $attrname != '' && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)){
-                       $sql_del = "DELETE FROM 
".MAIN_DB_PREFIX."adherent_options_label WHERE name =
-                       '$attrname';";
-                       $this->db->query($sql_del);
-                       $sql = "INSERT INTO 
".MAIN_DB_PREFIX."adherent_options_label (name,label)
-                       VALUES ('$attrname','".addslashes($escaped_label)."')";
-                       //$sql = "REPLACE INTO 
".MAIN_DB_PREFIX."adherent_options_label SET 
name='$attrname',label='$escaped_label'";
-
-                       if ( $this->db->query( $sql) )
-                       {
+                       $sql = 'UPDATE '.MAIN_DB_PREFIX.'adherent_options_label 
SET';
+                       $sql .= " label = '$label'";
+                       $sql .= ",type = '$type'";
+                       $sql .= ",size = '$size'";
+                       $sql .= " WHERE name = '$attrname';";
+                       if ($this->db->query($sql)) {
                                return 1;
-                       }
-                       else
-                       {
+                       } else {
                                print dol_print_error($this->db);
                                return 0;
                        }
@@ -317,22 +382,24 @@
        /*!
                \brief fonction qui modifie un label
                */
-       function fetch_optionals()
-       {
-               $this->fetch_name_optionals_label();
-       }
+       //function fetch_optionals()
+       //{
+       //      $this->fetch_name_optionals_label();
+       //}
 
 
        /**
-        *      \brief  Load array this->attribute_label
+        *      \brief  Load array this->attribute_definition
         */
-       function fetch_name_optionals_label()
+       function fetch_name_optionals_def($tablenum = -1)
        {
                $array_name_label=array();
-               $sql = "SELECT name,label,type FROM 
".MAIN_DB_PREFIX."adherent_options_label";
-               $sql.= " ORDER BY pos";
+               $sql = "SELECT name,label,type,tablenum,size FROM 
".MAIN_DB_PREFIX."adherent_options_label";
+               $sql.= " WHERE type != 'table'";
+               if ($tablenum != -1) $sql.= " AND tablenum = $tablenum";
+               $sql.= " ORDER BY tablenum, pos, name";
 
-               dol_syslog("Adherent_options::fetch_name_optionals_label");
+               dol_syslog("Adherent_options::fetch_name_optionals_def");
                $resql=$this->db->query($sql);
                if ($resql)
                {
@@ -342,11 +409,13 @@
                                {
                                        // we can add this attribute to 
adherent object
                                        
$array_name_label[$tab->name]=$tab->label;
-                                       
$this->attribute_name[$tab->name]=$tab->type;
-                                       
$this->attribute_label[$tab->name]=$tab->label;
+                                       
$this->attribute_definition[$tab->name]['type'] = $tab->type;
+                                       
$this->attribute_definition[$tab->name]['label'] = $tab->label;
+                                       
$this->attribute_definition[$tab->name]['tablenum'] = $tab->tablenum;
+                                       
$this->attribute_definition[$tab->name]['size'] = $tab->size;
                                }
                                return $array_name_label;
-                       }else{
+                       } else {
                                return array();
                        }
                }else{
@@ -356,4 +425,50 @@
 
        }
 }
+
+
+
+/**
+ *     \brief      Fonction qui recupere La liste des tables d'options et le 
label
+ *  \param avec_sans   si 1, ajoute une ligne.
+ */
+function fetch_optionals_table($avec_sans = -1)
+{
+       global $db;
+
+       $array_tables=array();
+       $sql = 'select tablenum, label';
+       $sql .= ' from '.MAIN_DB_PREFIX.'adherent_options_label';
+       $sql .= ' where type = \'table\'';
+       $sql .= ' order by tablenum asc';
+
+       dol_syslog("Adherent_options::fetch_optionals_table");
+       $resql=$db->query($sql);
+       if ($resql) {
+               if ($db->num_rows($resql)) {
+                       while ($tab = $db->fetch_object($resql))
+                       {
+                               $array_tables[$tab->tablenum]=$tab->label;
+                       }
+                       if ($avec_sans == 1) $array_tables[0] = '---';
+                       asort($array_tables);
+
+                       return $array_tables;
+               } else {
+                       return array();
+               }
+       } else {
+               print dol_print_error($db);
+               return array() ;
+       }
+
+       /**
+        *      \brief  Fonction qui crée un tableau d'attribut
+        *      \param  attrname                        nom du label
+        */
+       function create_labeltable($attrname)
+       {
+               return 0;
+       }
+}
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/adherent_option_table.class.php 
me/htdocs/adherents/adherent_option_table.class.php
--- dolibarr-snapshot/htdocs/adherents/adherent_option_table.class.php  
1970-01-01 01:00:00.000000000 +0100
+++ me/htdocs/adherents/adherent_option_table.class.php 2009-10-18 
21:57:57.000000000 +0200
@@ -0,0 +1,306 @@
+<?php
+/* Copyright (C) 2002-2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2002-2003 Jean-Louis Bergamo   <address@hidden>
+ * Copyright (C) 2004-2009 Laurent Destailleur  <address@hidden>
+ * Copyright (C) 2004      Sebastien Di Cintio  <address@hidden>
+ * Copyright (C) 2004      Benoit Mortier       <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ \file       htdocs/adherents/adherent_plus.class.php
+ \ingroup    adherent
+ \brief      Fichier de la classe permettant la gestion d'un adherent
+ \author     Thibaut des ABBAYES
+ \version    $Id: adherent_plus.class.php,v 0.0 2009/10/01 23:59:00 tibo Exp $
+ */
+
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+define('DOL_ADHERENT_PLUS_SORT_SEP', '.');
+
+/**
+ *      \class      AdherentPlus
+ *             \brief      Classe etendant la classe adherent et permettant la 
gestion des options en tableau
+ */
+
+// Classe gérant les options adhérent en tableau
+class AdherentOptionTable
+{
+       //  var $public;
+    var $db;
+    var $tablenum;
+    var $titre;
+    var $nblignes;
+    var $nbcolonnes;
+    var $arr_fields;
+    var $arr_data;
+    var $sortorder;
+
+
+       /**
+        *      \brief      Constructeur
+        *      \param      tablenum: numéro du tableau
+        */
+    function AdherentOptionTable($tablenum)
+    {
+        global $db;
+
+        $this->db = $db;
+        $this->tablenum = $tablenum;
+        $this->sortorder = '1';
+        $this->GetDefinition();
+//        $this->GetData();
+    }
+
+
+       /**
+        *      \brief      Récupère la définition du tableau
+        */
+    function GetDefinition()
+    {
+        $this->titre = '';
+        $this->nbcolonnes = 0;
+        $this->arr_fields = array();
+        $this->nblignes = 0;
+        $this->arr_data=array();
+        $sql = 'select name, tms, label, type, size, pos';
+        $sql .= ' from '.MAIN_DB_PREFIX.'adherent_options_label';
+        $sql .= ' where tablenum = '.$this->tablenum; //.' and type != 
\'table\'';
+        $sql .= ' order by pos, label';
+        $rdef=$this->db->query($sql);
+        if (($rdef) && ($this->db->num_rows($rdef)))
+        {
+            while ($ldef = $this->db->fetch_object($rdef))
+            {
+                if ($ldef->type == 'table')
+                {
+                    $this->titre = $ldef->label;
+                } else {
+                    $this->arr_fields[$this->nbcolonnes]['name'] = $ldef->name;
+                    $this->arr_fields[$this->nbcolonnes]['label'] = 
$ldef->label;
+                    $this->arr_fields[$this->nbcolonnes]['type'] = $ldef->type;
+                    $this->arr_fields[$this->nbcolonnes]['size'] = $ldef->size;
+                    $this->nbcolonnes++;
+                }
+            }
+            if ($this->titre == '')
+            {
+                // On n'a pas trouvé de nom de tableau
+                $this->titre = 'ERREUR: pas de titre!';
+            }
+        }
+    }
+
+
+       /**
+        *      \brief  Récupère toute les données du tableau pour cet 
adherent
+        *      \param adhid    id de l'adherent
+     *  \param sorfield nom du champ de tri
+     *  \param encoded_sortorder
+        */
+    function GetData($adhid, $encoded_sortorder)
+    {
+               if (!isset($encoded_sortorder)) $encoded_sortorder = 1;
+        $this->nblignes = 0;
+        $this->arr_data = array();
+        $nom_table=MAIN_DB_PREFIX.'adherent_options_'.ltrim($this->tablenum);
+        // Ordre de tri
+        $this->sortorder = adhplus_sortorder_du_tbl($encoded_sortorder, 
$this->tablenum);
+        // Construction de l'ordre sql
+        $champs = '';
+        reset($this->arr_fields);
+        while (list($k, $t) = each($this->arr_fields))
+        {
+            if ($champs != '') $champs .= ', ';
+            $champs .= $t['name'];
+        }
+        $sql =  "SELECT $champs, linenum FROM $nom_table";
+        $sql .= " WHERE adhid = $adhid";
+        $sql .= adhplus_libsort($encoded_sortorder, $this->tablenum);
+
+        $rcont=$this->db->query($sql);
+        if (($rcont) && ($this->db->num_rows($rcont)))
+        {
+            while ($lcont = $this->db->fetch_array($rcont))
+            {
+                $cette_ligne = $lcont['linenum'];
+                $this->arr_data[$cette_ligne] = $lcont;
+                // Supprime le doublon du à index/nom
+                for ($x=0;$x<=$this->nbcolonnes;$x++)
+                    unset($this->arr_data[$cette_ligne][$x]);
+                // Linenum n'est pas une donnée
+                unset($this->arr_data[$cette_ligne]['linenum']);
+                $this->nblignes++;
+            }
+        }
+
+    }
+
+
+    function insert_plus()
+    {
+        // Utilise la variable $POST pour récupérer les données
+        $sql = 'INSERT INTO 
'.MAIN_DB_PREFIX."adherent_options_".$_POST['tablenum'];
+        $fields = 'adhid';
+        $values=$_POST['id'];
+        reset($this->arr_fields);
+        while (list($k, $t) = each($this->arr_fields))
+        {
+            $fields .= ', '.$t['name'];
+
+            if ($t['type'] == 'int')
+                $values .= ', '.$_POST[$t['name']];
+            else
+                $values .= ", '".$_POST[$t['name']]."'";
+        }
+
+        $sql .= '('.$fields.') VALUES ('.$values.')';
+               $resql = $this->db->query($sql);
+        //die('AdherentPlus->insert_plus reste à développer:'.$sql);
+        return($resql);
+    }
+
+
+    function update_plus()
+    {
+        global $db;
+        // Utilise la variable $POST pour récupérer les données
+        $upd_list = '';
+        $where = 'adhid = '.$_POST['id'].' AND linenum = '.$_POST['linenum'];
+        reset($this->arr_fields);
+        while (list($k, $t) = each($this->arr_fields))
+        {
+            if ($upd_list != '') $upd_list .= ', ';
+            $upd_list .= $t['name'].' = ';
+
+            if ($t['type'] == 'int')
+                $upd_list .= $_POST[$t['name']];
+            else
+                $upd_list .= "'".$_POST[$t['name']]."'";
+        }
+
+        $sql = 'UPDATE 
'.MAIN_DB_PREFIX."adherent_options_".$_POST['tablenum'].' SET '.$upd_list.' 
WHERE '.$where;
+               $resql = $this->db->query($sql);
+        // die('AdherentPlus->update_plus reste à développer:'.$sql);
+        return($resql);
+    }
+
+
+    function delete_plus()
+    {
+        // Utilise la variable $POST pour récupérer les données
+        $where = 'adhid = '.$_POST['id'].' AND linenum = '.$_POST['linenum'];
+
+        $sql = 'DELETE FROM 
'.MAIN_DB_PREFIX."adherent_options_".$_POST['tablenum'].' WHERE '.$where;
+               $resql = $this->db->query($sql);
+        // die('AdherentPlus->delete_plus reste à développer:'.$sql);
+        return($resql);
+    }
+}
+
+
+function adhplus_sortorder_du_tbl($sortorder, $tablenum)
+{
+    $tmp = explode(DOL_ADHERENT_PLUS_SORT_SEP,$sortorder);
+
+    $resu = (isset($tmp[$tablenum-1])) ? $tmp[$tablenum-1] : '1';
+    return($resu);
+}
+
+
+function adhplus_tbl2sortorder($sortorder, $tablenum, $table_sortorder)
+{
+    $tmp = explode(DOL_ADHERENT_PLUS_SORT_SEP,$sortorder);
+    $tmp[$tablenum-1] = $table_sortorder;
+    return(implode(DOL_ADHERENT_PLUS_SORT_SEP,$tmp));
+}
+
+
+function adhplus_sortorder_default($nb_tbl)
+{
+    $tmp = array_fill(0, $nb_tbl, '1');
+    return(implode(DOL_ADHERENT_PLUS_SORT_SEP, $tmp));
+}
+
+
+function adhplus_libsort($sortorder, $tablenum)
+{
+    $tmp = adhplus_sortorder_du_tbl($sortorder, $tablenum);
+    if ($tmp < 0)
+        return(' ORDER BY '.abs($tmp).' DESC');
+    else
+        return(' ORDER BY '.abs($tmp).' ASC');
+}
+
+
+/**
+ *     \brief      Show title line of an array
+ *     \param      name        libelle champ
+ *     \param      file        url pour clic sur tri
+ *     \param      field       champ de tri
+ *     \param      options     ("" par defaut)
+ *     \param      td          options de l'attribut td ("" par defaut)
+ *     \param      sortfield   field currently used to sort
+ *     \param      sortorder   ordre du tri
+ */
+function print_liste_adh_plus_titre($name, $full_url, $tablenum, $fieldnum, 
$sortorder, $td='')
+{
+       global $conf;
+       //print "$name, $file, $field, $options, $td, $sortfield, 
$sortorder<br>\n";
+
+       // Le champ de tri est mis en evidence.
+       // Exemple si (sortfield,field)=("nom","xxx.nom") ou 
(sortfield,field)=("nom","nom")
+    $my_order = adhplus_sortorder_du_tbl($sortorder, $tablenum);
+    if ($fieldnum == abs($my_order))
+       {
+               print '<td class="liste_titre_sel" '. $td.'>';
+       }
+       else
+       {
+               print '<td class="liste_titre" '. $td.'>';
+       }
+       print $name;
+
+    print '<img width="2" src="'.DOL_URL_ROOT.'/theme/common/transparent.png" 
alt="">';
+    print '<a 
href="'.$full_url.'&sortorder='.adhplus_tbl2sortorder($sortorder, $tablenum, 
$fieldnum).'&amp;">'.img_down("A-Z",0).'</a>';
+    print '<a 
href="'.$full_url.'&sortorder='.adhplus_tbl2sortorder($sortorder, $tablenum, 
-$fieldnum).'&amp;">'.img_up("Z-A",0).'</a>';
+       print "</td>";
+}
+
+function adhplus_input($champ, $data)
+{
+    $taille_maxi = 50;
+    switch($champ['type'])
+    {
+        case 'date':
+            $maxlength=10;
+            $size=10;
+            $libtype='date (aaaa-mm-dd)';
+            break;
+        case 'int':
+            $maxlength=10;
+            $size=10;
+            break;
+        default:
+            $maxlength=$champ['size'];
+            $size=($maxlength < $taille_maxi) ? $maxlength : $taille_maxi;
+            $libtype=$champ['type'];
+            break;
+    }
+    print '<tr><td>'.$champ['label'].'</td><td>'.$libtype.'</td><td>';
+    print '<input type="text" name="'.$champ['name'].'" size="'.$size.' 
maxlength="'.$maxlength.' value="'.$data.'"></td></tr>'."\n";
+}
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/adherent_type.class.php 
me/htdocs/adherents/adherent_type.class.php
--- dolibarr-snapshot/htdocs/adherents/adherent_type.class.php  2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/adherent_type.class.php 2009-04-27 02:34:02.000000000 
+0200
@@ -18,19 +18,19 @@
  */
 
 /**
- *     \file       htdocs/adherents/adherent_type.class.php
- *     \ingroup    member
- *     \brief      Fichier de la classe gerant les types d'adherents
- *     \author     Rodolphe Quiedeville
- *     \version    $Id: adherent_type.class.php,v 1.21 2009/10/10 16:00:39 
eldy Exp $
+ \file       htdocs/adherents/adherent_type.class.php
+ \ingroup    adherent
+ \brief      Fichier de la classe gérant les types d'adhérents
+ \author     Rodolphe Quiedeville
+ \version    $Id: adherent_type.class.php,v 1.20 2009/02/20 22:53:24 eldy Exp $
  */
 
 require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
 
 
 /**
- *     \class      AdherentType
- *     \brief      Classe gerant les types d'adherents
+ \class      AdherentType
+ \brief      Classe gérant les types d'adhérents
  */
 class AdherentType extends CommonObject
 {
@@ -42,7 +42,7 @@
        var $id;
        var $libelle;
        var $statut;
-       var $cotisation;  /**< Soumis � la cotisation */
+       var $cotisation;  /**< Soumis à la cotisation */
        var $vote;              /**< droit de vote ? */
        var $note;              /**< commentaire */
        var $mail_valid;        /**< mail envoye lors de la validation */
@@ -51,7 +51,7 @@
 
        /**
         \brief AdherentType
-        \param DB                              handler acc�s base de 
donn�es
+        \param DB                              handler accès base de données
         */
        function AdherentType($DB)
        {
@@ -75,8 +75,8 @@
 
 
        /**
-        \brief      Fonction qui permet de cr�er le status de l'adh�rent
-        \param      userid                     userid de l'adh�rent
+        \brief      Fonction qui permet de créer le status de l'adhérent
+        \param      userid                     userid de l'adhérent
         \return     > 0 si ok, < 0 si ko
         */
        function create($userid)
@@ -102,7 +102,7 @@
 
 
        /**
-               \brief      Met a jour en base donn�es du type
+               \brief      Met a jour en base données du type
                \return     > 0 si ok, < 0 si ko
                */
        function update()
@@ -134,7 +134,7 @@
        }
 
        /**
-        *      \brief      Fonction qui permet de supprimer le status de 
l'adh�rent
+        *      \brief      Fonction qui permet de supprimer le status de 
l'adhérent
         *      \param      rowid
         */
        function delete($rowid)
@@ -161,7 +161,7 @@
        }
 
        /**
-               \brief          Fonction qui permet de r�cup�rer le status 
de l'adh�rent
+               \brief          Fonction qui permet de récupérer le status de 
l'adhérent
                \param          rowid
                \return         int                     <0 si KO, >0 si OK
                */
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/card_subscriptions.php 
me/htdocs/adherents/card_subscriptions.php
--- dolibarr-snapshot/htdocs/adherents/card_subscriptions.php   2009-10-23 
05:00:08.000000000 +0200
+++ me/htdocs/adherents/card_subscriptions.php  2009-10-18 22:09:16.000000000 
+0200
@@ -20,9 +20,9 @@
 
 /**
  *       \file       htdocs/adherents/card_subscriptions.php
- *       \ingroup    member
+ *       \ingroup    adherent
  *       \brief      Onglet d'ajout, edition, suppression des adh�sions d'un 
adh�rent
- *       \version    $Id: card_subscriptions.php,v 1.40 2009/10/22 11:13:32 
hregis Exp $
+ *       \version    $Id: card_subscriptions.php,v 1.32 2009/02/20 22:53:24 
eldy Exp $
  */
 
 require("./pre.inc.php");
@@ -81,7 +81,7 @@
        }
        $cotisation=$_POST["cotisation"];       // Amount of subscription
        $label=$_POST["label"];
-
+       
        if (! $datecotisation)
        {
                $errmsg=$langs->trans("BadDateFormat");
@@ -91,7 +91,7 @@
        {
                
$datesubend=dol_time_plus_duree(dol_time_plus_duree($datecotisation,$defaultdelay,$defaultdelayunit),-1,'d');
        }
-
+       
        // Payment informations
        $accountid=$_POST["accountid"];
        $operation=$_POST["operation"]; // Payment mode
@@ -160,11 +160,14 @@
 }
 
 
-/*
- * View
- */
 
-llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+/* ************************************************************************** 
*/
+/*                                                                            
*/
+/* Mode affichage                                                             
*/
+/*                                                                            
*/
+/* ************************************************************************** 
*/
+
+llxHeader();
 
 $html = new Form($db);
 
@@ -175,7 +178,7 @@
 $adht->fetch($adh->typeid);
 
 // fetch optionals attributes and labels
-$adho->fetch_optionals();
+$adh->fetch_optionals($rowid);
 
 
 /*
@@ -183,10 +186,9 @@
  */
 $head = member_prepare_head($adh);
 
-dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user');
+dol_fiche_head($head, 'subscription', $langs->trans("Member"));
 
 print '<form action="fiche.php" method="post">';
-print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 print '<table class="border" width="100%">';
 
 // Ref
@@ -221,7 +223,7 @@
 
 if ($errmsg)
 {
-       if (preg_match('/^Error/i',$errmsg))
+       if (eregi('^Error',$errmsg))
        {
                $langs->load("errors");
                $errmsg=$langs->trans($errmsg);
@@ -375,7 +377,6 @@
        print "\n\n<!-- Form add subscription -->\n";
 
        print '<form name="cotisation" method="post" 
action="'.$_SERVER["PHP_SELF"].'">';
-       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
        print '<input type="hidden" name="action" value="cotisation">';
        print '<input type="hidden" name="rowid" value="'.$rowid.'">';
        print "<table class=\"border\" width=\"100%\">\n";
@@ -430,13 +431,13 @@
                print '<tr><td>'.$langs->trans("Label").'</td>';
                print '<td><input name="label" type="text" size="32" 
value="'.$langs->trans("Subscription").' ';
                print dol_print_date(($datefrom?$datefrom:time()),"%Y").'" 
></td></tr>';
-
+               
                // Bank account
                if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE)
                {
                        // Title payments
                        print '<tr><td 
colspan="2"><b>'.$langs->trans("Payment").'</b></td></tr>';
-
+                       
                        // Bank account
                        print 
'<tr><td>'.$langs->trans("FinancialAccount").'</td><td>';
                        
$html->select_comptes($_POST["accountid"],'accountid',0,'',1);
@@ -446,17 +447,17 @@
                        print 
'<tr><td>'.$langs->trans("PaymentMode").'</td><td>';
                        
$html->select_types_paiements($_POST["operation"],'operation');
                        print "</td></tr>\n";
-
+       
                        print '<tr><td>'.$langs->trans('Numero');
                        print ' 
<em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
                        print '</td>';
                        print '<td><input name="num_chq" type="text" size="8" 
value="'.(empty($_POST['num_chq'])?'':$_POST['num_chq']).'"></td></tr>';
-
+       
                        print '<tr><td>'.$langs->trans('CheckTransmitter');
                        print ' <em>('.$langs->trans("ChequeMaker").')</em>';
                        print '</td>';
                        print '<td><input name="chqemetteur" size="32" 
type="text" 
value="'.(empty($_POST['chqemetteur'])?$facture->client->nom:$_POST['chqemetteur']).'"></td></tr>';
-
+       
                        print '<tr><td>'.$langs->trans('Bank');
                        print ' <em>('.$langs->trans("ChequeBank").')</em>';
                        print '</td>';
@@ -477,7 +478,7 @@
                $s2=$langs->trans("MailFrom").': 
<b>'.$conf->global->ADHERENT_MAIL_FROM.'</b><br>';
                $s2.=$langs->trans("MailRecipient").': <b>'.$adh->email.'</b>';
                //$s2.='<br>'.$langs->trans("Content").': 
'.nl2br($conf->global->ADHERENT_MAIL_COTIS);
-               print $html->textwithpicto($s1,$s2,1);
+               print $html->textwithhelp($s1,$s2,1);
        }
        print '</td></tr>';
 
@@ -501,5 +502,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/22 11:13:32 $ - $Revision: 1.40 $');
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.32 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/cartes/carte.php 
me/htdocs/adherents/cartes/carte.php
--- dolibarr-snapshot/htdocs/adherents/cartes/carte.php 2009-05-19 
02:40:01.000000000 +0200
+++ me/htdocs/adherents/cartes/carte.php        2009-04-27 02:34:02.000000000 
+0200
@@ -22,7 +22,7 @@
  *     \file           htdocs/adherents/cartes/carte.php
  *     \ingroup    adherent
  *     \brief      Page de creation d'une carte PDF
- *     \version    $Id: carte.php,v 1.26 2009/04/29 22:15:47 eldy Exp $
+ *     \version    $Id: carte.php,v 1.25 2009/03/12 23:14:35 eldy Exp $
  */
 
 require("./pre.inc.php");
@@ -50,7 +50,7 @@
                   );
 
 
-$dir = $conf->adherent->dir_temp;
+$dir = $conf->adherent->dir_tmp;
 $file = $dir . "/tmpcard.pdf";
 
 if (! file_exists($dir))
@@ -147,7 +147,7 @@
 {
        dol_print_error($db);
 
-       llxFooter('$Date: 2009/04/29 22:15:47 $ - $Revision: 1.26 $');
+       llxFooter('$Date: 2009/03/12 23:14:35 $ - $Revision: 1.25 $');
 }
 
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/cartes/etiquette.php 
me/htdocs/adherents/cartes/etiquette.php
--- dolibarr-snapshot/htdocs/adherents/cartes/etiquette.php     2009-05-19 
02:40:01.000000000 +0200
+++ me/htdocs/adherents/cartes/etiquette.php    2009-04-27 02:34:02.000000000 
+0200
@@ -22,7 +22,7 @@
  *     \file           htdocs/adherents/cartes/etiquette.php
  *     \ingroup    adherent
  *     \brief      Page de creation d'etiquettes
- *     \version    $Id: etiquette.php,v 1.17 2009/04/29 22:15:47 eldy Exp $
+ *     \version    $Id: etiquette.php,v 1.16 2009/03/12 23:31:27 eldy Exp $
  */
 
 require("./pre.inc.php");
@@ -31,7 +31,7 @@
 require_once(DOL_DOCUMENT_ROOT.'/includes/modules/member/PDF_card.class.php');
 
 
-$dir = $conf->adherent->dir_temp;
+$dir = $conf->adherent->dir_tmp;
 $file = $dir . "/tmplabel.pdf";
 
 if (! file_exists($dir))
@@ -115,7 +115,7 @@
 {
        dol_print_error($db);
 
-       llxFooter('$Date: 2009/04/29 22:15:47 $ - $Revision: 1.17 $');
+       llxFooter('$Date: 2009/03/12 23:31:27 $ - $Revision: 1.16 $');
 }
 
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/cotisation.class.php 
me/htdocs/adherents/cotisation.class.php
--- dolibarr-snapshot/htdocs/adherents/cotisation.class.php     2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/cotisation.class.php    2009-05-08 05:26:12.000000000 
+0200
@@ -18,25 +18,23 @@
  */
 
 /**
- *             \file           htdocs/adherents/cotisation.class.php
- *      \ingroup    member
- *             \brief      File of class to manage subscriptions
- *             \version    $Id: cotisation.class.php,v 1.34 2009/10/10 
16:00:37 eldy Exp $
- */
+               \file           htdocs/adherents/cotisation.class.php
+        \ingroup    adherent
+               \brief      Fichier de la classe permettant de gèrer les 
cotisations
+               \version    $Id: cotisation.class.php,v 1.32.2.1 2009/05/08 
03:26:11 eldy Exp $
+*/
 
 
 /**
- *     \class          Cotisation
- *     \brief      Class to manage subscriptions
- */
+       \class          Cotisation
+       \brief      Classe permettant de gèrer les cotisations
+*/
 class Cotisation extends CommonObject
 {
        var $id;
        var $db;
        var $error;
        var $errors;
-       var $element='subscription';
-       var $table_element='cotisation';
 
        var $datec;
        var $datem;
@@ -49,9 +47,9 @@
 
 
        /**
-        *              \brief Constructor
-        *              \param DB                               Handler base de 
donnees
-        */
+                       \brief Cotisation
+                       \param DB                               Handler base de 
données
+       */
        function Cotisation($DB)
        {
                $this->db = $DB;
@@ -59,10 +57,10 @@
 
 
        /**
-        *      \brief          Fonction qui permet de creer la cotisation
-        *      \param          userid          userid de celui qui insere
-        *      \return         int                     <0 si KO, Id cotisation 
cree si OK
-        */
+               \brief          Fonction qui permet de créer le don
+               \param          userid          userid de celui qui insere
+               \return         int                     <0 si KO, Id cotisation 
créé si OK
+       */
        function create($userid)
        {
                // Check parameters
@@ -94,7 +92,7 @@
 
 
        /**
-               \brief          Fonction qui permet de r�cup�rer une 
cotisation
+               \brief          Fonction qui permet de récupèrer une cotisation
                \param          rowid           Id cotisation
                \return         int                     <0 si KO, =0 si OK mais 
non trouve, >0 si OK
        */
@@ -183,13 +181,13 @@
        }
 
        /**
-        *              \brief          Delete a subscription
+        *              \brief          Fonction qui permet de supprimer la 
cotisation
         *              \param          rowid   Id cotisation
         *              \return         int             <0 si KO, 0 si OK mais 
non trouve, >0 si OK
         */
-       function delete($user)
+       function delete()
        {
-               // It subscription is linked to a bank transaction, we get it
+               // Verification
                if ($this->fk_bank)
                {
                        
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
@@ -214,7 +212,7 @@
 
                                if ($this->fk_bank)
                                {
-                                       $result=$accountline->delete($user);    
        // Return false if refused because line is conciliated
+                                       $result=$accountline->delete();         
// Renvoi faux si ligne rapprocher
                                        if ($result > 0)
                                        {
                                                $this->db->commit();
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/cotisations.php 
me/htdocs/adherents/cotisations.php
--- dolibarr-snapshot/htdocs/adherents/cotisations.php  2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/cotisations.php 2009-04-27 02:34:02.000000000 +0200
@@ -20,9 +20,9 @@
 
 /**
  *      \file       htdocs/adherents/cotisations.php
- *      \ingroup    member
+ *      \ingroup    adherent
  *             \brief      Page de consultation et insertion d'une cotisation
- *             \version    $Id: cotisations.php,v 1.47 2009/10/10 16:00:38 
eldy Exp $
+ *             \version    $Id: cotisations.php,v 1.42 2009/03/09 10:27:21 
eldy Exp $
  */
 
 require("./pre.inc.php");
@@ -136,10 +136,10 @@
 
 
 /*
- * View
+ * Affichage page
  */
 
-llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader();
 
 if ($msg)      print $msg.'<br>';
 
@@ -212,7 +212,6 @@
         if ($allowinsertbankafter && ! $objp->fk_account && 
$conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && $objp->cotisation)
                {
                        print "<form method=\"post\" 
action=\"cotisations.php\">";
-                       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
                }
         print "<tr $bc[$var]>";
 
@@ -317,5 +316,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:38 $ - $Revision: 1.47 $');
+llxFooter('$Date: 2009/03/09 10:27:21 $ - $Revision: 1.42 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/fiche.php me/htdocs/adherents/fiche.php
--- dolibarr-snapshot/htdocs/adherents/fiche.php        2009-10-22 
03:05:22.000000000 +0200
+++ me/htdocs/adherents/fiche.php       2009-10-18 22:31:52.000000000 +0200
@@ -20,9 +20,9 @@
 
 /**
  *       \file       htdocs/adherents/fiche.php
- *       \ingroup    member
+ *       \ingroup    adherent
  *       \brief      Page d'ajout, edition, suppression d'une fiche adherent
- *       \version    $Id: fiche.php,v 1.171 2009/10/21 18:31:03 hregis Exp $
+ *       \version    $Id: fiche.php,v 1.149 2009/03/25 19:12:36 eldy Exp $
  */
 
 require("./pre.inc.php");
@@ -40,20 +40,20 @@
 $langs->load("members");
 $langs->load("users");
 
-// If socid provided by ajax company selector
-if (! empty($_REQUEST['socid_id']))
+// Defini si peux creer un utilisateur ou gerer groupe sur un utilisateur
+$canadduser=$user->rights->adherent->creer;
+// Defini si peux lire/modifier info user ou mot de passe
+if ($_GET["rowid"])
 {
-       $_GET['socid'] = $_GET['socid_id'];
-       $_POST['socid'] = $_POST['socid_id'];
-       $_REQUEST['socid'] = $_REQUEST['socid_id'];
+       $caneditfield=$user->rights->adherent->creer;
+       $caneditpassword=$user->rights->adherent->creer;
 }
-
-// Security check
 if (! $user->rights->adherent->lire)
 {
        accessforbidden();
 }
 
+
 $adh = new Adherent($db);
 $adho = new AdherentOptions($db);
 $errmsg='';
@@ -62,99 +62,19 @@
 $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
 $typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"];
 
-if ($rowid)
-{
-       // Load member
-       $result = $adh->fetch($rowid);
-
-       // Define variables to know what current user can do on users
-       $canadduser=($user->admin || $user->rights->user->user->creer);
-       // Define variables to know what current user can do on properties of 
user linked to edited member
-       if ($adh->user_id)
-       {
-               // $user est le user qui edite, $adh->user_id est l'id de 
l'utilisateur lies au membre edite
-               $caneditfielduser=( (($user->id == $adh->user_id) && 
$user->rights->user->self->creer)
-               || (($user->id != $adh->user_id) && 
$user->rights->user->user->creer) );
-               $caneditpassworduser=( (($user->id == $adh->user_id) && 
$user->rights->user->self->password)
-               || (($user->id != $adh->user_id) && 
$user->rights->user->user->password) );
-       }
-}
-
-// Define variables to know what current user can do on members
-$canaddmember=$user->rights->adherent->creer;
-// Define variables to know what current user can do on properties of a member
-if ($rowid)
-{
-       $caneditfieldmember=$user->rights->adherent->creer;
-}
-
 
 
 /*
  *     Actions
  */
 
-if ($_POST['action'] == 'setuserid' && ($user->rights->user->self->creer || 
$user->rights->user->user->creer))
-{
-       $error=0;
-       if (empty($user->rights->user->user->creer))    // If can edit only 
itself user, we can link to itself only
-       {
-               if ($_POST["userid"] != $user->id && $_POST["userid"] != 
$adh->user_id)
-               {
-                       $error++;
-                       $mesg='<div 
class="error">'.$langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly").'</div>';
-               }
-       }
-
-       if (! $error)
-       {
-               if ($_POST["userid"] != $adh->user_id)  // If link differs from 
currently in database
-               {
-                       $result=$adh->setUserId($_POST["userid"]);
-                       if ($result < 0) dol_print_error($adh->db,$adh->error);
-                       $_POST['action']='';
-                       $action='';
-               }
-       }
-}
-if ($_POST['action'] == 'setsocid')
-{
-       $error=0;
-       if (! $error)
-       {
-               if ($_POST["socid"] != $adh->fk_soc)    // If link differs from 
currently in database
-               {
-                       $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
-                       $sql.=" WHERE fk_soc = '".$_POST["socid"]."'";
-                       $resql = $db->query($sql);
-                       if ($resql)
-                       {
-                               $obj = $db->fetch_object($resql);
-                               if ($obj && $obj->rowid > 0)
-                               {
-                                       $othermember=new Adherent($db);
-                                       $othermember->fetch($obj->rowid);
-                                       $thirdparty=new Societe($db);
-                                       $thirdparty->fetch($_POST["socid"]);
-                                       $error++;
-                                       $mesg='<div 
class="error">'.$langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->fullname,$othermember->login,$thirdparty->nom).'</div>';
-                               }
-                       }
-
-                       if (! $error)
-                       {
-                               $result=$adh->setThirdPartyId($_POST["socid"]);
-                               if ($result < 0) 
dol_print_error($adh->db,$adh->error);
-                               $_POST['action']='';
-                               $action='';
-                       }
-               }
-       }
-}
-
 // Create user from a member
 if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && 
$user->rights->user->user->creer)
 {
+       // Recuperation contact actuel
+       $adh = new Adherent($db);
+       $result = $adh->fetch($_GET["rowid"]);
+
        if ($result > 0)
        {
                // Creation user
@@ -176,6 +96,9 @@
 // Create third party from a member
 if ($_POST["action"] == 'confirm_create_thirdparty' && $_POST["confirm"] == 
'yes' && $user->rights->societe->creer)
 {
+       $adh = new Adherent($db);
+       $result = $adh->fetch($_GET["rowid"]);
+
        if ($result > 0)
        {
                // Creation user
@@ -194,127 +117,119 @@
        }
 }
 
-if ($_REQUEST["action"] == 'confirm_sendinfo' && $_REQUEST["confirm"] == 'yes')
+if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
 {
+    $adh->id = $rowid;
+    $adh->fetch($rowid);
+
        if ($adh->email)
        {
-               
$result=$adh->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
-               $mesg=$langs->trans("CardSent");
+               $result=$adh->send_an_email("Voici le contenu de votre 
fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent");
        }
 }
 
-if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"] && 
$user->rights->adherent->creer)
+if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"])
 {
-       $datenaiss='';
-       if (isset($_POST["naissday"]) && $_POST["naissday"]
-               && isset($_POST["naissmonth"]) && $_POST["naissmonth"]
-               && isset($_POST["naissyear"]) && $_POST["naissyear"])
-       {
-               $datenaiss=dol_mktime(12, 0, 0, $_POST["naissmonth"], 
$_POST["naissday"], $_POST["naissyear"]);
-       }
-       //print $_POST["naissmonth"].", ".$_POST["naissday"].", 
".$_POST["naissyear"]." ".$datenaiss." ".adodb_strftime('%Y-%m-%d 
%H:%M:%S',$datenaiss);
+       $result=$adh->fetch($_POST["rowid"]);
 
-       // Create new object
-       if ($result > 0)
+       // If change (allowed on all members) or (allowed on myself and i am 
edited memeber)
+       if ($user->rights->adherent->creer || 
($user->rights->adherent->self->creer && $adh->user_id == $user->id))
        {
-               $adh->oldcopy=dol_clone($adh);
-
-               // Modifie valeures
-               $adh->prenom      = trim($_POST["prenom"]);
-               $adh->nom         = trim($_POST["nom"]);
-               $adh->fullname    = trim($adh->prenom.' '.$adh->nom);
-               $adh->login       = trim($_POST["login"]);
-               $adh->pass        = trim($_POST["pass"]);
-
-               $adh->societe     = trim($_POST["societe"]);
-               $adh->adresse     = trim($_POST["adresse"]);
-               $adh->cp          = trim($_POST["cp"]);
-               $adh->ville       = trim($_POST["ville"]);
-               $adh->pays_id     = $_POST["pays"];
-
-               $adh->phone       = trim($_POST["phone"]);
-               $adh->phone_perso = trim($_POST["phone_perso"]);
-               $adh->phone_mobile= trim($_POST["phone_mobile"]);
-               $adh->email       = trim($_POST["email"]);
-               $adh->naiss       = $datenaiss;
-
-               $adh->typeid      = $_POST["typeid"];
-               $adh->note        = trim($_POST["comment"]);
-               $adh->morphy      = $_POST["morphy"];
-
-               $adh->amount      = $_POST["amount"];
-
-               // Get status and public property
-               $adh->statut      = $_POST["statut"];
-               $adh->public      = $_POST["public"];
-
-               foreach($_POST as $key => $value)
-               {
-                       if (preg_match("/^options_/",$key))
-                       {
-                               //escape values from POST, at least with 
addslashes, to avoid obvious SQL injections
-                               //(array_options is directly input in the DB in 
adherent.class.php::update())
-                               
$adh->array_options[$key]=addslashes($_POST[$key]);
-                       }
-               }
-
-               // Check if we need to also synchronize user information
-               $nosyncuser=0;
-               if ($adh->user_id)      // If linked to a user
+               $datenaiss='';
+               if (isset($_POST["naissday"]) && $_POST["naissday"]
+                       && isset($_POST["naissmonth"]) && $_POST["naissmonth"]
+                       && isset($_POST["naissyear"]) && $_POST["naissyear"])
                {
-                       if ($user->id != $adh->user_id && 
empty($user->rights->user->user->creer)) $nosyncuser=1;               // 
Disable synchronizing
+                       $datenaiss=dol_mktime(12, 0, 0, $_POST["naissmonth"], 
$_POST["naissday"], $_POST["naissyear"]);
                }
+               //print $_POST["naissmonth"].", ".$_POST["naissday"].", 
".$_POST["naissyear"]." ".$datenaiss." ".adodb_strftime('%Y-%m-%d 
%H:%M:%S',$datenaiss);
 
-               // Check if we need to also synchronize password information
-               $nosyncuserpass=0;
-               if ($adh->user_id)      // If linked to a user
+               // Charge objet actuel
+               if ($result > 0)
                {
-                       if ($user->id != $adh->user_id && 
empty($user->rights->user->user->password)) $nosyncuserpass=1;        // 
Disable synchronizing
-               }
+                       // Modifie valeures
+                       $adh->prenom      = trim($_POST["prenom"]);
+                       $adh->nom         = trim($_POST["nom"]);
+                       $adh->fullname    = trim($adh->prenom.' '.$adh->nom);
+                       $adh->login       = trim($_POST["login"]);
+                       $adh->pass        = trim($_POST["pass"]);
+
+                       $adh->societe     = trim($_POST["societe"]);
+                       $adh->adresse     = trim($_POST["adresse"]);
+                       $adh->cp          = trim($_POST["cp"]);
+                       $adh->ville       = trim($_POST["ville"]);
+                       $adh->pays_id     = $_POST["pays"];
+
+                       $adh->phone       = trim($_POST["phone"]);
+                       $adh->phone_perso = trim($_POST["phone_perso"]);
+                       $adh->phone_mobile= trim($_POST["phone_mobile"]);
+                       $adh->email       = trim($_POST["email"]);
+                       $adh->naiss       = $datenaiss;
+
+                       $adh->typeid      = $_POST["typeid"];
+                       $adh->note        = trim($_POST["comment"]);
+                       $adh->morphy      = $_POST["morphy"];
+
+                       $adh->amount      = $_POST["amount"];
+
+                       // recuperation du statut et public
+                       $adh->statut      = $_POST["statut"];
+                       $adh->public      = $_POST["public"];
 
-               $result=$adh->update($user,0,$nosyncuser,$nosyncuserpass);
-               if ($result >= 0 && ! sizeof($adh->errors))
-               {
-                       if (isset($_FILES['photo']['tmp_name']) && 
trim($_FILES['photo']['tmp_name']))
+                       foreach($_POST as $key => $value)
                        {
-                               // If photo is provided
-                               if (! is_dir($conf->adherent->dir_output))
+                               if (ereg("^options_",$key))
                                {
-                                       
create_exdir($conf->adherent->dir_output);
+                                       //escape values from POST, at least 
with addslashes, to avoid obvious SQL injections
+                                       //(array_options is directly input in 
the DB in adherent.class.php::update())
+                                       
$adh->array_options[$key]=addslashes($_POST[$key]);
                                }
-                               if (is_dir($conf->adherent->dir_output))
+                       }
+
+                       $result=$adh->update($user,0);
+                       if ($result >= 0 && ! sizeof($adh->errors))
+                       {
+                               if (isset($_FILES['photo']['tmp_name']) && 
trim($_FILES['photo']['tmp_name']))
                                {
-                                       $newfile=$conf->adherent->dir_output . 
"/" . $adh->id . ".jpg";
-                                       if (! 
dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1) > 0)
+                                       // If photo is provided
+                                       if (! 
is_dir($conf->adherent->dir_output))
                                        {
-                                               $message .= '<div 
class="error">'.$langs->trans("ErrorFailedToSaveFile").'</div>';
+                                               
create_exdir($conf->adherent->dir_output);
+                                       }
+                                       if (is_dir($conf->adherent->dir_output))
+                                       {
+                                               
$newfile=$conf->adherent->dir_output . "/" . $adh->id . ".jpg";
+                                               if (! 
dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1) > 0)
+                                               {
+                                                       $message .= '<div 
class="error">'.$langs->trans("ErrorFailedToSaveFile").'</div>';
+                                               }
                                        }
                                }
-                       }
 
-                       $_GET["rowid"]=$adh->id;
-                       $_REQUEST["action"]='';
-               }
-               else
-               {
-                   if ($adh->error)
-                       {
-                               $errmsg=$adh->error;
+                               $_GET["rowid"]=$adh->id;
+                               $_REQUEST["action"]='';
                        }
                        else
                        {
-                               foreach($adh->errors as $error)
+                           if ($adh->error)
+                               {
+                                       $errmsg=$adh->error;
+                               }
+                               else
                                {
-                                       if ($errmsg) $errmsg.='<br>';
-                                       $errmsg.=$error;
+                                       foreach($adh->errors as $error)
+                                       {
+                                               if ($errmsg) $errmsg.='<br>';
+                                               $errmsg.=$error;
+                                       }
                                }
+                               $action='';
                        }
-                       $action='';
                }
        }
 }
 
-if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
+if ($user->rights->adherent->creer && $_POST["action"] == 'add')
 {
        $datenaiss='';
        if (isset($_POST["naissday"]) && $_POST["naissday"]
@@ -349,9 +264,6 @@
     $morphy=$_POST["morphy"];
     $cotisation=$_POST["cotisation"];
 
-    $userid=$_POST["userid"];
-    $socid=$_POST["socid"];
-
     $adh->prenom      = $prenom;
     $adh->nom         = $nom;
     $adh->societe     = $societe;
@@ -370,12 +282,8 @@
     $adh->typeid      = $typeid;
     $adh->note        = $comment;
     $adh->morphy      = $morphy;
-    $adh->user_id     = $userid;
-    $adh->fk_soc      = $socid;
-    foreach($_POST as $key => $value)
-    {
-        if (preg_match("/^options_/",$key))
-        {
+    foreach($_POST as $key => $value){
+        if (ereg("^options_",$key)){
                        //escape values from POST, at least with addslashes, to 
avoid obvious SQL injections
                        //(array_options is directly input in the DB in 
adherent.class.php::update())
                        $adh->array_options[$key]=addslashes($_POST[$key]);
@@ -465,8 +373,9 @@
             }
 
                        $db->commit();
-                       $rowid=$adh->id;
-                       $action='';
+
+            Header("Location: liste.php?statut=-1");
+            exit;
         }
         else
                {
@@ -483,8 +392,9 @@
     }
 }
 
-if ($user->rights->adherent->supprimer && $_REQUEST["action"] == 
'confirm_delete' && $_REQUEST["confirm"] == 'yes')
+if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_delete' 
&& $_POST["confirm"] == 'yes')
 {
+       $result=$adh->fetch($rowid);
     $result=$adh->delete($rowid);
     if ($result > 0)
     {
@@ -499,6 +409,7 @@
 
 if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_valid' && 
$_POST["confirm"] == 'yes')
 {
+       $result=$adh->fetch($rowid);
     $result=$adh->validate($user);
 
     $adht = new AdherentType($db);
@@ -551,6 +462,7 @@
 
 if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_resign' 
&& $_POST["confirm"] == 'yes')
 {
+    $result=$adh->fetch($rowid);
     $result=$adh->resiliate($user);
 
     $adht = new AdherentType($db);
@@ -595,7 +507,8 @@
 
 if ($user->rights->adherent->supprimer && $_POST["action"] == 
'confirm_del_spip' && $_POST["confirm"] == 'yes')
 {
-       if (! sizeof($adh->errors))
+    $result=$adh->fetch($rowid);
+       if ($result >= 0 && ! sizeof($adh->errors))
        {
            if(!$adh->del_to_spip()){
                $errmsg.="Echec de la suppression de l'utilisateur dans spip: 
".$adh->error."<BR>\n";
@@ -605,7 +518,8 @@
 
 if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_add_spip' 
&& $_POST["confirm"] == 'yes')
 {
-       if (! sizeof($adh->errors))
+    $result=$adh->fetch($rowid);
+       if ($result >= 0 && ! sizeof($adh->errors))
        {
            if (!$adh->add_to_spip())
            {
@@ -620,19 +534,17 @@
  * View
  */
 
-llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader();
 
-$html = new Form($db);
 
 if ($errmsg)
 {
     print '<div class="error">'.$errmsg.'</div>';
     print "\n";
 }
-if ($mesg) print '<div class="ok">'.$mesg.'</div>';
 
 // fetch optionals attributes and labels
-$adho->fetch_name_optionals_label();
+$adho->fetch_name_optionals_def();
 
 
 if ($action == 'edit')
@@ -650,7 +562,7 @@
        // fetch optionals value
        $adh->fetch_optionals($rowid);
        // fetch optionals attributes and labels
-       $adho->fetch_name_optionals_label();
+       $adho->fetch_name_optionals_def();
 
        $adht = new AdherentType($db);
     $adht->fetch($adh->typeid);
@@ -661,42 +573,39 @@
         */
        $head = member_prepare_head($adh);
 
-       dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
+       dol_fiche_head($head, 'general', $langs->trans("Member"));
 
-       $rowspan=15;
-       $rowspan+=sizeof($adho->attribute_label);
-       if ($conf->societe->enabled) $rowspan++;
 
        print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" 
method="post" enctype="multipart/form-data">';
-       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
        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."\">";
 
+       $htmls = new Form($db);
+
        print '<table class="border" width="100%">';
 
     // Ref
-    print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur" 
colspan="2">'.$adh->id.'</td></tr>';
-
-       // Physique-Moral
-       $morphys["phy"] = $langs->trans("Physical");
-       $morphys["mor"] = $langs->trans("Morale");
-       print "<tr><td>".$langs->trans("Person").'*</td><td colspan="2">';
-       $html->select_array("morphy",  $morphys, $adh->morphy);
-       print "</td></tr>";
-
-       // Societe
-       print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2"><input 
type="text" name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
+    print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur" 
colspan="2">'.$adh->id.'&nbsp;</td></tr>';
 
        // Nom
        print '<tr><td>'.$langs->trans("Lastname").'*</td><td><input 
type="text" name="nom" size="40" value="'.$adh->nom.'"></td>';
 
        // Photo
+       $rowspan=16;
+       //$rowspan+=sizeof($adho->attribute_definition);
     print '<td align="center" valign="middle" width="25%" 
rowspan="'.$rowspan.'">';
-       print $html->showphoto('member',$adh);
-    if ($caneditfieldmember)
+    if (file_exists($conf->adherent->dir_output."/".$adh->id.".jpg"))
+    {
+        print '<img width="100" 
src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=memberphoto&file='.$adh->id.'.jpg">';
+    }
+    else
     {
-        print '<br><br><table 
class="nobordernopadding"><tr><td>'.$langs->trans("PhotoFile").'</td></tr>';
+        print '<img src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">';
+    }
+    if ($caneditfield)
+    {
+        print '<br><br><table 
class="noborder"><tr><td>'.$langs->trans("PhotoFile").'</td></tr>';
         print '<tr><td>';
         print '<input type="file" class="flat" name="photo">';
         print '</td></tr></table>';
@@ -716,9 +625,9 @@
 
        // Type
        print '<tr><td>'.$langs->trans("Type").'*</td><td>';
-       if ($user->rights->adherent->creer)
+       if ($user->rights->adherent->creer)     // If 
$user->rights->adherent->self->creer, we do not allow.
        {
-               $html->select_array("typeid",  $adht->liste_array(), 
$adh->typeid);
+               $htmls->select_array("typeid",  $adht->liste_array(), 
$adh->typeid);
        }
        else
        {
@@ -727,16 +636,26 @@
        }
        print "</td></tr>";
 
-       // Address
+       // Physique-Moral
+       $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></tr>";
+
+       // Societe
+       print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" 
name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
+
+       // Adresse
        print '<tr><td>'.$langs->trans("Address").'</td><td>';
        print '<textarea name="adresse" wrap="soft" cols="40" 
rows="2">'.$adh->adresse.'</textarea></td></tr>';
 
        // Cp
        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>';
 
-       // Country
+       // Pays
        print '<tr><td>'.$langs->trans("Country").'</td><td>';
-       
$html->select_pays($adh->pays_code?$adh->pays_code:$mysoc->pays_code,'pays');
+       
$htmls->select_pays($adh->pays_code?$adh->pays_code:$mysoc->pays_code,'pays');
        print '</td></tr>';
 
        // Tel
@@ -753,45 +672,20 @@
 
        // Date naissance
     print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
-    $html->select_date(($adh->naiss ? $adh->naiss : 
-1),'naiss','','',1,'update');
+    $htmls->select_date(($adh->naiss ? $adh->naiss : 
-1),'naiss','','',1,'update');
     print "</td></tr>\n";
 
        // Profil public
     print "<tr><td>".$langs->trans("Public")."</td><td>\n";
-    print $html->selectyesno("public",$adh->public,1);
+    print $htmls->selectyesno("public",$adh->public,1);
     print "</td></tr>\n";
 
        // Attributs supplementaires
-       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";
-       }
-
-       // Third party Dolibarr
-    if ($conf->societe->enabled)
-    {
-       print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td 
class="valeur">';
-       if ($adh->fk_soc)
-           {
-               $company=new Societe($db);
-               $result=$company->fetch($adh->fk_soc);
-               print $company->getNomUrl(1);
-           }
-           else
-           {
-               print $langs->trans("NoThirdPartyAssociatedToMember");
-           }
-           print '</td></tr>';
-    }
-
-    // Login Dolibarr
-       print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td 
class="valeur">';
-       if ($adh->user_id)
+       while (list($key, $option) = each($adho->attribute_definition))
        {
-               print 
$html->form_users($_SERVER['PHP_SELF'].'?rowid='.$adh->id,$adh->user_id,'none');
+               if ($option['tablenum'] == 0)
+                       print '<tr><td>'.$option['label'].'</td><td 
colspan=2><input type="text" name="options_'.$key.'" size="40" 
value="'.$adh->array_options["options_$key"].'"></td></tr>'."\n";
        }
-       else print $langs->trans("NoDolibarrAccess");
-       print '</td></tr>';
 
        print '<tr><td colspan="3" align="center">';
        print '<input type="submit" class="button" name="submit" 
value="'.$langs->trans("Save").'">';
@@ -814,26 +708,16 @@
        /*                                                                      
      */
        /* 
************************************************************************** */
 
+    $htmls = new Form($db);
     $adht = new AdherentType($db);
 
     print_fiche_titre($langs->trans("NewMember"));
 
-       print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post" 
enctype="multipart/form-data">';
-       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
+       print '<form name="add" action="fiche.php" method="post" 
enctype="multipart/form-data">';
     print '<input type="hidden" name="action" value="add">';
 
     print '<table class="border" width="100%">';
 
-       // Moral-Physique
-    $morphys["phy"] = "Physique";
-    $morphys["mor"] = "Morale";
-    print "<tr><td>".$langs->trans("Person")."*</td><td>\n";
-    $html->select_array("morphy", $morphys, $adh->morphy);
-    print "</td>\n";
-
-    // Company
-    print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" 
name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
-
     // Nom
     print '<tr><td>'.$langs->trans("Lastname").'*</td><td><input type="text" 
name="nom" value="'.$adh->nom.'" size="40"></td>';
     print '</tr>';
@@ -865,12 +749,22 @@
     $listetype=$adht->liste_array();
     if (sizeof($listetype))
     {
-        $html->select_array("typeid", $listetype, $typeid);
+        $htmls->select_array("typeid", $listetype, $typeid);
     } else {
         print '<font 
class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>';
     }
     print "</td>\n";
 
+
+       // Moral-Physique
+    $morphys["phy"] = "Physique";
+    $morphys["mor"] = "Morale";
+    print "<tr><td>".$langs->trans("Person")."*</td><td>\n";
+    $htmls->select_array("morphy", $morphys, $adh->morphy);
+    print "</td>\n";
+
+    print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" 
name="societe" size="40" value="'.$adh->societe.'"></td></tr>';
+
     // Adresse
     print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
     print '<textarea name="adresse" wrap="soft" cols="40" 
rows="2">'.$adh->adresse.'</textarea></td></tr>';
@@ -880,7 +774,7 @@
 
        // Pays
     print '<tr><td>'.$langs->trans("Country").'</td><td>';
-    $html->select_pays($adh->pays_id ? $adh->pays_id : 
$mysoc->pays_id,'pays_id');
+    $htmls->select_pays($adh->pays_id ? $adh->pays_id : 
$mysoc->pays_id,'pays_id');
     print '</td></tr>';
 
     // Tel pro
@@ -897,34 +791,22 @@
 
        // Date naissance
     print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
-    $html->select_date(($adh->naiss ? $adh->naiss : -1),'naiss','','',1,'add');
+    $htmls->select_date(($adh->naiss ? $adh->naiss : 
-1),'naiss','','',1,'add');
     print "</td></tr>\n";
 
+       // Attribut optionnels
+       while (list($key, $option) = each($adho->attribute_definition))
+    {
+               if ($option['tablenum'] == 0)
+                       print '<tr><td>'.$option['label'].'</td><td 
colspan=2><input type="text" name="options_'.$key.'" size="40"></td></tr>'."\n";
+    }
+
        // Profil public
     print "<tr><td>".$langs->trans("Public")."</td><td>\n";
-    print $html->selectyesno("public",$adh->public,1);
+    print $htmls->selectyesno("public",$adh->public,1);
     print "</td></tr>\n";
 
-    // Attribut optionnels
-    foreach($adho->attribute_label as $key=>$value)
-    {
-        print "<tr><td>$value</td><td><input type=\"text\" 
name=\"options_$key\" size=\"40\"></td></tr>\n";
-    }
 
-/*
-       // Third party Dolibarr
-    if ($conf->societe->enabled)
-    {
-           print 
'<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td 
class="valeur">';
-               print $html->select_societes($adh->fk_soc,'socid','',1);
-           print '</td></tr>';
-    }
-
-    // Login Dolibarr
-       print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td 
class="valeur">';
-       print $html->select_users($adh->user_id,'userid',1);
-       print '</td></tr>';
-*/
     print "</table>\n";
     print '<br>';
 
@@ -957,7 +839,7 @@
         */
        $head = member_prepare_head($adh);
 
-       dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
+       dol_fiche_head($head, 'general', $langs->trans("Member"));
 
        if ($msg) print '<div class="error">'.$msg.'</div>';
 
@@ -971,8 +853,8 @@
                $formquestion=array(
                array('label' => $langs->trans("LoginToCreate"), 'type' => 
'text', 'name' => 'login', 'value' => $login));
 
-               
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateLogin"),"confirm_create_user",$formquestion);
-               if ($ret == 'html') print '<br>';
+               
$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateLogin"),"confirm_create_user",$formquestion);
+               print '<br>';
        }
 
        // Confirm create third party
@@ -994,26 +876,33 @@
                $formquestion=array(
                array('label' => $langs->trans("NameToCreate"), 'type' => 
'text', 'name' => 'companyname', 'value' => $name));
 
-               
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion);
-               if ($ret == 'html') print '<br>';
+               
$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion);
+               print '<br>';
        }
 
+       // Confirm remove member
+    if ($action == 'delete')
+    {
+        
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete");
+        print '<br>';
+    }
+
     // Confirm validate member
     if ($action == 'valid')
     {
                // Cree un tableau formulaire
                $formquestion=array();
-               if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 
'name' => 'send_mail', 'label' => 
$langs->trans("SendAnEMailToMember",$adh->email),  'value' => 
($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
+               if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 
'name' => 'send_mail', 'label' => 
$langs->trans("SendAnEMailToMember",$adh->email),  'value' => 'true');
 
-        
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion);
-        if ($ret == 'html') print '<br>';
+        
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion);
+        print '<br>';
     }
 
     // Confirm send card by mail
     if ($action == 'sendinfo')
     {
-        
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo",'',0,1);
-        if ($ret == 'html') print '<br>';
+        
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo");
+        print '<br>';
     }
 
     // Confirm resiliate
@@ -1028,15 +917,8 @@
                $label.=')';
                if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 
'name' => 'send_mail', 'label' => $label, 'value' => 
($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?'true':'false'));
 
-               
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion);
-        if ($ret == 'html') print '<br>';
-    }
-
-       // Confirm remove member
-    if ($action == 'delete')
-    {
-        
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",'',0,1);
-        if ($ret == 'html') print '<br>';
+               
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion);
+        print '<br>';
     }
 
     /*
@@ -1044,8 +926,8 @@
     */
     if ($action == 'add_spip')
     {
-        $ret=$html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans 
spip","Etes-vous sur de vouloir ajouter cet adherent dans spip ? (serveur : 
".ADHERENT_SPIP_SERVEUR.")","confirm_add_spip");
-        if ($ret == 'html') print '<br>';
+        $html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans 
spip","Etes-vous sur de vouloir ajouter cet adherent dans spip ? (serveur : 
".ADHERENT_SPIP_SERVEUR.")","confirm_add_spip");
+        print '<br>';
     }
 
     /*
@@ -1053,14 +935,12 @@
     */
     if ($action == 'del_spip')
     {
-        $ret=$html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans 
spip","Etes-vous sur de vouloir effacer cet adherent dans spip ? (serveur : 
".ADHERENT_SPIP_SERVEUR.")","confirm_del_spip");
-        if ($ret == 'html') print '<br>';
+        $html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans 
spip","Etes-vous sur de vouloir effacer cet adherent dans spip ? (serveur : 
".ADHERENT_SPIP_SERVEUR.")","confirm_del_spip");
+        print '<br>';
     }
 
-    $rowspan=14+sizeof($adho->attribute_label);
-    if ($conf->societe->enabled) $rowspan++;
 
-    print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
+    print '<form action="fiche.php" method="post" 
enctype="multipart/form-data">';
     print '<table class="border" width="100%">';
 
     // Ref
@@ -1069,13 +949,7 @@
        print $html->showrefnav($adh,'rowid');
        print '</td></tr>';
 
-    // Morphy
-    print '<tr><td>'.$langs->trans("Person").'</td><td class="valeur" 
colspan="2">'.$adh->getmorphylib().'</td></tr>';
-
-    // Company
-    print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur" 
colspan="2">'.$adh->societe.'</td></tr>';
-
-       // Nom
+    // Nom
     print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" 
colspan="2">'.$adh->nom.'&nbsp;</td>';
        print '</tr>';
 
@@ -1084,18 +958,32 @@
 
     // Login
     print '<tr><td>'.$langs->trans("Login").'</td><td 
class="valeur">'.$adh->login.'&nbsp;</td>';
+    $rowspan=16; //+sizeof($adho->attribute_definition);
        print '<td rowspan="'.$rowspan.'" align="center" valign="middle" 
width="25%">';
-       print $html->showphoto('member',$adh);
+    if (file_exists($conf->adherent->dir_output."/".$adh->id.".jpg"))
+    {
+        print '<img width="100" 
src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=memberphoto&file='.$adh->id.'.jpg">';
+    }
+    else
+    {
+        print '<img width="100" 
src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">';
+    }
     print '</td>';
        print '</tr>';
 
        // Password
-       print 
'<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i','*',$adh->pass).'</td></tr>';
+       print 
'<tr><td>'.$langs->trans("Password").'</td><td>'.eregi_replace('.','*',$adh->pass).'</td></tr>';
 
        // Type
        print '<tr><td>'.$langs->trans("Type").'</td><td 
class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
 
-    // Address
+    // Morphy
+    print '<tr><td>'.$langs->trans("Person").'</td><td 
class="valeur">'.$adh->getmorphylib().'</td></tr>';
+
+    // Company
+    print '<tr><td>'.$langs->trans("Company").'</td><td 
class="valeur">'.$adh->societe.'</td></tr>';
+
+    // Adresse
     print '<tr><td>'.$langs->trans("Address").'</td><td 
class="valeur">'.nl2br($adh->adresse).'</td></tr>';
 
     // CP / Ville
@@ -1125,80 +1013,44 @@
     // Status
     print '<tr><td>'.$langs->trans("Status").'</td><td 
class="valeur">'.$adh->getLibStatut(4).'</td></tr>';
 
-    // Other attributs
-    foreach($adho->attribute_label as $key=>$value)
-    {
-        print 
"<tr><td>$value</td><td>".$adh->array_options["options_$key"]."&nbsp;</td></tr>\n";
-    }
+       // Login Dolibarr
+       print '<tr><td>'.$langs->trans("DolibarrLogin").'</td><td 
class="valeur">';
+       if ($adh->user_id)
+       {
+               $dolibarr_user=new User($db);
+               $dolibarr_user->id=$adh->user_id;
+               $result=$dolibarr_user->fetch();
+               print $dolibarr_user->getLoginUrl(1);
+       }
+       else print $langs->trans("NoDolibarrAccess");
+       print '</td></tr>';
 
        // Third party Dolibarr
     if ($conf->societe->enabled)
     {
-           print '<tr><td>';
-               print '<table class="nobordernopadding" width="100%"><tr><td>';
-           print $langs->trans("LinkedToDolibarrThirdParty");
-           print '</td>';
-               if ($_GET['action'] != 'editthirdparty' && 
$user->rights->adherent->creer) print '<td align="right"><a 
href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$adh->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>';
-               print '</tr></table>';
-           print '</td><td class="valeur">';
-               if ($_GET['action'] == 'editthirdparty')
-               {
-                       $page=$_SERVER['PHP_SELF'].'?rowid='.$adh->id;
-                       $htmlname='socid';
-                       print '<form method="post" action="'.$page.'" 
name="form'.$htmlname.'">';
-                       print '<input type="hidden" name="action" 
value="set'.$htmlname.'">';
-                       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
-                       print '<table class="nobordernopadding" cellpadding="0" 
cellspacing="0">';
-                       print '<tr><td>';
-                       print $html->select_societes($adh->fk_soc,'socid','',1);
-                       print '</td>';
-                       print '<td align="left"><input type="submit" 
class="button" value="'.$langs->trans("Modify").'"></td>';
-                       print '</tr></table></form>';
-               }
-               else
-               {
-                       if ($adh->fk_soc)
-                   {
-                       $company=new Societe($db);
-                       $result=$company->fetch($adh->fk_soc);
-                       print $company->getNomUrl(1);
-                   }
-                   else
-                   {
-                       print $langs->trans("NoThirdPartyAssociatedToMember");
-                   }
-               }
+           print '<tr><td>'.$langs->trans("ThirdPartyDolibarr").'</td><td 
class="valeur">';
+           if ($adh->fk_soc)
+           {
+               $company=new Societe($db);
+               $result=$company->fetch($adh->fk_soc);
+               print $company->getNomUrl(1);
+           }
+           else
+           {
+               print $langs->trans("NoThirdPartyAssociatedToMember");
+           }
            print '</td></tr>';
     }
 
-       // Login Dolibarr
-       print '<tr><td>';
-       print '<table class="nobordernopadding" width="100%"><tr><td>';
-       print $langs->trans("LinkedToDolibarrUser");
-       print '</td>';
-       if ($_GET['action'] != 'editlogin' && $user->rights->adherent->creer) 
print '<td align="right"><a 
href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$adh->id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'</a></td>';
-       print '</tr></table>';
-       print '</td><td class="valeur">';
-       if ($_GET['action'] == 'editlogin')
-       {
-               /*$include=array();
-               if (empty($user->rights->user->user->creer))    // If can edit 
only itself user, we can link to itself only
-               {
-                       $include=array($adh->user_id,$user->id);
-               }*/
-               print 
$html->form_users($_SERVER['PHP_SELF'].'?rowid='.$adh->id,$adh->user_id,'userid','');
-       }
-       else
-       {
-               if ($adh->user_id)
-               {
-                       print 
$html->form_users($_SERVER['PHP_SELF'].'?rowid='.$adh->id,$adh->user_id,'none');
-               }
-               else print $langs->trans("NoDolibarrAccess");
-       }
-       print '</td></tr>';
+    // Other attributs
+       while (list($key, $option) = each($adho->attribute_definition))
+    {
+               if ($option['tablenum'] == 0)
+                       print '<tr><td>'.$option['label'].'</td><td 
colspan=2>'.$adh->array_options["options_$key"].'&nbsp;</td></tr>'."\n";
+    }
 
     print "</table>\n";
+    print '</form>';
 
     print "</div>\n";
 
@@ -1209,131 +1061,129 @@
      */
     print '<div class="tabsAction">';
 
-    if ($action != 'valid' && $action != 'editlogin' && $action != 
'editthirdparty')
-    {
-           // Modify
+    // Modify
+       if ($user->rights->adherent->creer || 
($user->rights->adherent->self->creer && $adh->user_id == $user->id))
+       {
+               print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$rowid&action=edit\">".$langs->trans("Modify")."</a>";
+    }
+       else
+       {
+               print "<font class=\"butActionRefused\" 
href=\"#\">".$langs->trans("Modify")."</font>";
+       }
+
+       // Valider
+       if ($adh->statut == -1)
+       {
                if ($user->rights->adherent->creer)
                {
-                       print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$rowid&action=edit\">".$langs->trans("Modify")."</a>";
-           }
+                       print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n";
+               }
                else
                {
-                       print "<font class=\"butActionRefused\" href=\"#\" 
title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Modify")."</font>";
+                       print "<font class=\"butActionRefused\" 
href=\"#\">".$langs->trans("Validate")."</font>";
                }
+       }
 
-               // Valider
-               if ($adh->statut == -1)
+       // Reactiver
+       if ($adh->statut == 0)
+       {
+               if ($user->rights->adherent->creer)
                {
-                       if ($user->rights->adherent->creer)
-                       {
-                               print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n";
-                       }
-                       else
-                       {
-                               print "<font class=\"butActionRefused\" 
href=\"#\" 
title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Validate")."</font>";
-                       }
+               print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Reenable")."</a>\n";
+           }
+               else
+               {
+                       print "<font class=\"butActionRefused\" 
href=\"#\">".$langs->trans("Reenable")."</font>";
                }
+       }
 
-               // Reactiver
-               if ($adh->statut == 0)
+       // Envoi fiche par mail
+       if ($adh->statut >= 1 && $adh->email)
+       {
+               if ($user->rights->adherent->creer)
                {
-                       if ($user->rights->adherent->creer)
-                       {
-                       print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Reenable")."</a>\n";
-                   }
-                       else
-                       {
-                               print "<font class=\"butActionRefused\" 
href=\"#\" 
title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Reenable")."</font>";
-                       }
+               print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$adh->id&action=sendinfo\">".$langs->trans("SendCardByMail")."</a>\n";
+           }
+               else
+               {
+                       print "<font class=\"butActionRefused\" 
href=\"#\">".$langs->trans("SendCardByMail")."</font>";
                }
+       }
 
-               // Envoi fiche par mail
-               if ($adh->statut >= 1 && $adh->email)
+       // Resilier
+       if ($adh->statut >= 1)
+       {
+               if ($user->rights->adherent->supprimer)
                {
-                       if ($user->rights->adherent->creer)
-                       {
-                       print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$adh->id&action=sendinfo\">".$langs->trans("SendCardByMail")."</a>\n";
-                   }
-                       else
-                       {
-                               print "<font class=\"butActionRefused\" 
href=\"#\" 
title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("SendCardByMail")."</font>";
-                       }
+               print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n";
+           }
+               else
+               {
+                       print "<font class=\"butActionRefused\" 
href=\"#\">".$langs->trans("Resiliate")."</font>";
                }
+       }
 
-               // Resilier
-               if ($adh->statut >= 1)
+       // Create user
+       if (! $user->societe_id && ! $adh->user_id)
+       {
+               if ($user->rights->user->user->creer)
                {
-                       if ($user->rights->adherent->supprimer)
-                       {
-                       print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n";
-                   }
-                       else
-                       {
-                               print "<font class=\"butActionRefused\" 
href=\"#\" 
title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Resiliate")."</font>";
-                       }
+                       print '<a class="butAction" 
href="fiche.php?rowid='.$adh->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>';
                }
-
-               // Create third party
-               if ($conf->societe->enabled && ! $adh->fk_soc)
+               else
                {
-                       if ($user->rights->societe->creer)
-                       {
-                               print '<a class="butAction" 
href="fiche.php?rowid='.$adh->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a>';
-                       }
-                       else
-                       {
-                               print "<font class=\"butActionRefused\" 
href=\"#\" 
title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("CreateDolibarrThirdParty")."</font>";
-                       }
+                       print "<font class=\"butActionRefused\" 
href=\"#\">".$langs->trans("CreateDolibarrLogin")."</font>";
                }
+       }
 
-               // Create user
-               if (! $user->societe_id && ! $adh->user_id)
+       // Create third party
+       if ($conf->societe->enabled && ! $adh->fk_soc)
+       {
+               if ($user->rights->societe->creer)
                {
-                       if ($user->rights->user->user->creer)
-                       {
-                               print '<a class="butAction" 
href="fiche.php?rowid='.$adh->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>';
-                       }
-                       else
-                       {
-                               print "<font class=\"butActionRefused\" 
href=\"#\" 
title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("CreateDolibarrLogin")."</font>";
-                       }
+                       print '<a class="butAction" 
href="fiche.php?rowid='.$adh->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a>';
                }
-
-               // Delete
-           if ($user->rights->adherent->supprimer)
-           {
-               print "<a class=\"butActionDelete\" 
href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
-           }
                else
                {
-                       print "<font class=\"butActionRefused\" href=\"#\" 
title=\"".dol_escape_htmltag($langs->trans("NotEnoughPermissions"))."\">".$langs->trans("Delete")."</font>";
+                       print "<font class=\"butActionRefused\" 
href=\"#\">".$langs->trans("CreateDolibarrThirdParty")."</font>";
                }
+       }
 
-           // Action SPIP
-           if ($conf->global->ADHERENT_USE_SPIP)
-           {
-               $isinspip=$adh->is_in_spip();
-               if ($isinspip == 1)
-               {
-                   print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$adh->id&action=del_spip\">Suppression dans Spip</a>\n";
-               }
-               if ($isinspip == 0)
-               {
-                   print "<a class=\"butAction\" 
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->error.'</font>';
-               }
-           }
+       // Supprimer
+    if ($user->rights->adherent->supprimer)
+    {
+        print "<a class=\"butActionDelete\" 
href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
+    }
+       else
+       {
+               print "<font class=\"butActionRefused\" 
href=\"#\">".$langs->trans("Delete")."</font>";
+       }
 
+    // Action SPIP
+    if ($conf->global->ADHERENT_USE_SPIP)
+    {
+        $isinspip=$adh->is_in_spip();
+        if ($isinspip == 1)
+        {
+            print "<a class=\"butAction\" 
href=\"fiche.php?rowid=$adh->id&action=del_spip\">Suppression dans Spip</a>\n";
+        }
+        if ($isinspip == 0)
+        {
+            print "<a class=\"butAction\" 
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->error.'</font>';
+        }
     }
 
     print '</div>';
     print "<br>\n";
 
 
+
     /*
      * Bandeau des cotisations
+     *
      */
 
     print '<table border=0 width="100%">';
@@ -1351,5 +1201,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/21 18:31:03 $ - $Revision: 1.171 $');
+llxFooter('$Date: 2009/03/25 19:12:36 $ - $Revision: 1.149 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/fiche_subscription.php 
me/htdocs/adherents/fiche_subscription.php
--- dolibarr-snapshot/htdocs/adherents/fiche_subscription.php   2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/fiche_subscription.php  2009-04-27 02:34:02.000000000 
+0200
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2007-2009 Laurent Destailleur  <address@hidden>
+/* Copyright (C) 2007-2008 Laurent Destailleur  <address@hidden>
  *
  * 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
@@ -17,11 +17,11 @@
  */
 
 /**
- *       \file       htdocs/adherents/fiche_subscription.php
- *       \ingroup    member
- *       \brief      Page d'ajout, edition, suppression d'une fiche adh�sion
- *       \version    $Id: fiche_subscription.php,v 1.22 2009/10/10 16:00:36 
eldy Exp $
- */
+        \file       htdocs/adherents/fiche_subscription.php
+        \ingroup    adherent
+        \brief      Page d'ajout, edition, suppression d'une fiche adhésion
+        \version    $Id: fiche_subscription.php,v 1.15 2009/02/20 22:53:24 
eldy Exp $
+*/
 
 require("./pre.inc.php");
 require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
@@ -126,7 +126,7 @@
        }
 }
 
-if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' 
&& $user->rights->adherent->cotisation->creer)
+if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 
'confirm_delete' && $_POST["confirm"] == 'yes')
 {
        $result=$subscription->fetch($rowid);
     $result=$subscription->delete();
@@ -147,7 +147,7 @@
  * View
  */
 
-llxHeader('',$langs->trans("SubscriptionCard"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader();
 
 $form = new Form($db);
 
@@ -191,7 +191,6 @@
 
        print "\n";
        print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" 
method="post">';
-       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
        print "<input type=\"hidden\" name=\"action\" value=\"update\">";
        print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
        print "<input type=\"hidden\" name=\"fk_bank\" 
value=\"".$subscription->fk_bank."\">";
@@ -287,23 +286,22 @@
        $head[$h][2] = 'info';
        $h++;
 
-       dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 
'payment');
+       dol_fiche_head($head, 'general', $langs->trans("Subscription"));
 
        if ($msg) print '<div class="error">'.$msg.'</div>';
 
-    // Confirmation to delete subscription
+    // Confirmation de la suppression de l'adhérent
     if ($action == 'delete')
     {
                //$formquestion=array();
         
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
                $text=$langs->trans("ConfirmDeleteSubscription");
                if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) 
$text.='<br>'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord");
-               
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1);
-        if ($ret == 'html') print '<br>';
+               
$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion);
+        print '<br>';
     }
 
     print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
-    print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
     print '<table class="border" width="100%">';
 
     // Ref
@@ -393,5 +391,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:36 $ - $Revision: 1.22 $');
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.15 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/htpasswd.php me/htdocs/adherents/htpasswd.php
--- dolibarr-snapshot/htdocs/adherents/htpasswd.php     2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/htpasswd.php    2009-04-27 02:34:02.000000000 +0200
@@ -20,10 +20,10 @@
 
 /**
                \file           htdocs/adherents/htpasswd.php
-        \ingroup    member
+        \ingroup    adherent
                \brief      Page d'export htpasswd du fichier des adherents
                \author     Rodolphe Quiedeville
-               \version    $Id: htpasswd.php,v 1.12 2009/10/10 16:00:35 eldy 
Exp $
+               \version    $Id: htpasswd.php,v 1.11 2009/02/20 22:53:24 eldy 
Exp $
 */
 
 require("./pre.inc.php");
@@ -82,5 +82,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:35 $ - $Revision: 1.12 $');
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.11 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/index.php me/htdocs/adherents/index.php
--- dolibarr-snapshot/htdocs/adherents/index.php        2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/index.php       2009-04-27 02:34:02.000000000 +0200
@@ -20,7 +20,7 @@
 
 /**
  *       \file       htdocs/adherents/index.php
- *       \ingroup    member
+ *       \ingroup    adherent
  *       \brief      Page accueil module adherents
  */
 
@@ -37,7 +37,7 @@
  * View
  */
 
-llxHeader('',$langs->trans("Members"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader($langs->trans("Members"),'','EN:Fundations|FR:Adherents|ES:Miembros');
 
 $staticmember=new Adherent($db);
 $statictype=new AdherentType($db);
@@ -119,7 +119,6 @@
 
 // Formulaire recherche adherent
 print '<form action="liste.php" method="post">';
-print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 print '<input type="hidden" name="action" value="search">';
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -161,7 +160,7 @@
 {
        $var=!$var;
        print "<tr $bc[$var]>";
-       print '<td><a 
href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").'
 '.$adhtype->getNomUrl(0,dol_size(16)).'</a></td>';
+       print '<td><a 
href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").'
 '.$adhtype->getNomUrl(0,20).'</a></td>';
        print '<td align="right">'.(isset($MemberToValidate[$key]) && 
$MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' 
'.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
        print '<td align="right">'.(isset($MembersValidated[$key]) && 
($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? 
$MembersValidated[$key]-$MemberUpToDate[$key]:'').' 
'.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
        print '<td align="right">'.(isset($MemberUpToDate[$key]) && 
$MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' 
'.$staticmember->LibStatut(1,$adhtype->cotisation,gmmktime(),3).'</td>';
@@ -304,5 +303,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:35 $ - $Revision: 1.59 $');
+llxFooter('$Date: 2009/04/01 23:26:20 $ - $Revision: 1.53 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/info.php me/htdocs/adherents/info.php
--- dolibarr-snapshot/htdocs/adherents/info.php 2009-08-13 05:00:07.000000000 
+0200
+++ me/htdocs/adherents/info.php        2009-04-27 02:34:02.000000000 +0200
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2005-2009 Laurent Destailleur  <address@hidden>
+/* Copyright (C) 2005-2006 Laurent Destailleur  <address@hidden>
  * Copyright (C) 2005-2006 Regis Houssin        <address@hidden>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -18,11 +18,11 @@
  */
 
 /**
- *      \file       htdocs/adherents/info.php
- *      \ingroup    member
- *             \brief      Page des informations d'un adherent
- *             \version    $Id: info.php,v 1.10 2009/08/12 12:59:15 eldy Exp $
- */
+        \file       htdocs/adherents/info.php
+        \ingroup    member
+               \brief      Page des informations d'un adherent
+               \version    $Id: info.php,v 1.8 2009/03/02 18:25:51 eldy Exp $
+*/
 
 require("./pre.inc.php");
 require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
@@ -39,19 +39,23 @@
 
 
 /*
- * View
+ * Visualisation de la fiche
+ *
  */
 
-llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader();
 
 $adh = new Adherent($db);
 $adh->id=$_GET["id"];
 $adh->fetch($_GET["id"]);
 $adh->info($_GET["id"]);
 
+/*
+ * Affichage onglets
+ */
 $head = member_prepare_head($adh);
 
-dol_fiche_head($head, 'info', $langs->trans("Member"), 0, 'user');
+dol_fiche_head($head, 'info', $langs->trans("Member"));
 
 
 print '<table width="100%"><tr><td>';
@@ -63,5 +67,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/08/12 12:59:15 $ - $Revision: 1.10 $');
+llxFooter('$Date: 2009/03/02 18:25:51 $ - $Revision: 1.8 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/info_subscription.php 
me/htdocs/adherents/info_subscription.php
--- dolibarr-snapshot/htdocs/adherents/info_subscription.php    2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/info_subscription.php   2009-04-27 02:34:02.000000000 
+0200
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2005-2009 Laurent Destailleur  <address@hidden>
+/* Copyright (C) 2005-2006 Laurent Destailleur  <address@hidden>
  * Copyright (C) 2005-2006 Regis Houssin        <address@hidden>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -18,10 +18,10 @@
  */
 
 /**
- *      \file       htdocs/adherents/info.php
- *      \ingroup    member
- *             \brief      Page des informations d'un adherent
- *             \version    $Id: info_subscription.php,v 1.7 2009/10/10 
16:00:35 eldy Exp $
+        \file       htdocs/adherents/info.php
+        \ingroup    member
+               \brief      Page des informations d'un adherent
+               \version    $Id: info_subscription.php,v 1.6 2009/03/02 
18:25:51 eldy Exp $
 */
 
 require("./pre.inc.php");
@@ -68,7 +68,7 @@
 $h++;
 
 
-dol_fiche_head($head, 'info', $langs->trans("Subscription"), '', 'payment');
+dol_fiche_head($head, 'info', $langs->trans("Subscription"));
 
 $subscription->info($rowid);
 
@@ -81,5 +81,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:35 $ - $Revision: 1.7 $');
+llxFooter('$Date: 2009/03/02 18:25:51 $ - $Revision: 1.6 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/ldap.php me/htdocs/adherents/ldap.php
--- dolibarr-snapshot/htdocs/adherents/ldap.php 2009-10-10 18:07:01.000000000 
+0200
+++ me/htdocs/adherents/ldap.php        2009-04-27 02:34:02.000000000 +0200
@@ -18,11 +18,11 @@
  */
 
 /**
- *       \file       htdocs/adherents/ldap.php
- *       \ingroup    ldap member
- *       \brief      Page fiche LDAP adherent
- *       \version    $Id: ldap.php,v 1.23 2009/10/10 16:00:38 eldy Exp $
- */
+        \file       htdocs/adherents/ldap.php
+        \ingroup    ldap
+        \brief      Page fiche LDAP adherent
+        \version    $Id: ldap.php,v 1.17 2009/02/20 22:53:24 eldy Exp $
+*/
 
 require("./pre.inc.php");
 require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
@@ -45,6 +45,16 @@
     $socid = $user->societe_id;
 }
 
+
+/*
+ *     Affichage page
+ */
+
+llxHeader();
+
+$html = new Form($db);
+
+
 $adh = new Adherent($db);
 $adh->id = $rowid;
 $result=$adh->fetch($rowid);
@@ -64,52 +74,18 @@
 }
 
 
-/*
- * Actions
- */
-
-if ($_GET["action"] == 'dolibarr2ldap')
-{
-       $message="";
-
-       $db->begin();
-
-       $ldap=new Ldap();
-       $result=$ldap->connect_bind();
-
-       $info=$adh->_load_ldap_info();
-       $dn=$adh->_load_ldap_dn($info);
-       $olddn=$dn;     // We can say that old dn = dn as we force synchro
-
-       $result=$ldap->update($dn,$info,$user,$olddn);
-
-       if ($result >= 0)
-       {
-               $message.='<div 
class="ok">'.$langs->trans("MemberSynchronized").'</div>';
-               $db->commit();
-       }
-       else
-       {
-               $message.='<div class="error">'.$ldap->error.'</div>';
-               $db->rollback();
-       }
-}
-
-
 
 /*
- *     View
+ * Affichage onglets
  */
-
-llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
-
-$html = new Form($db);
-
 $head = member_prepare_head($adh);
 
-dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
+dol_fiche_head($head, 'ldap', $langs->trans("Member"));
 
 
+/*
+ * Fiche en mode visu
+ */
 print '<table class="border" width="100%">';
 
 // Ref
@@ -130,7 +106,7 @@
 print '<tr><td>'.$langs->trans("Login").'</td><td 
class="valeur">'.$adh->login.'&nbsp;</td></tr>';
 
 // Password not crypted
-if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD)
+if ($conf->global->LDAP_FIELD_PASSWORD)
 {
        print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
        print '<td class="valeur">'.$fuser->pass.'</td>';
@@ -138,7 +114,7 @@
 }
 
 // Password crypted
-if ($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)
+if ($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)
 {
        print '<tr><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td>';
        print '<td class="valeur">'.$fuser->pass_crypted.'</td>';
@@ -153,7 +129,7 @@
 // LDAP DN
 print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td 
class="valeur">'.$conf->global->LDAP_MEMBER_DN."</td></tr>\n";
 
-// LDAP Cle
+// LDAP Clé
 print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td 
class="valeur">'.$conf->global->LDAP_KEY_MEMBERS."</td></tr>\n";
 
 // LDAP Server
@@ -167,30 +143,12 @@
 
 print '</div>';
 
+print '<br>';
 
-if ($message) { print $message; }
 
-
-/*
- * Barre d'actions
- */
-
-print '<div class="tabsAction">';
-
-if ($conf->global->LDAP_MEMBER_SYNCHRO_ACTIVE == 'dolibarr2ldap')
-{
-       print '<a class="butAction" 
href="'.$_SERVER["PHP_SELF"].'?id='.$adh->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
-}
-
-print "</div>\n";
-
-if ($conf->global->LDAP_MEMBER_SYNCHRO_ACTIVE == 'dolibarr2ldap') print 
"<br>\n";
-
-
-
-// Affichage attributs LDAP
 print_titre($langs->trans("LDAPInformationsForThisMember"));
 
+// Affichage attributs LDAP
 print '<table width="100%" class="noborder">';
 
 print '<tr class="liste_titre">';
@@ -215,7 +173,7 @@
        {
                if (! is_array($records))
                {
-                       print '<tr '.$bc[false].'><td colspan="2"><font 
class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
+                       print '<tr '.$bc[false].'><td colspan="2"><font 
class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';     
                }
                else
                {
@@ -243,5 +201,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:38 $ - $Revision: 1.23 $');
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.17 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/liste.php me/htdocs/adherents/liste.php
--- dolibarr-snapshot/htdocs/adherents/liste.php        2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/liste.php       2009-04-27 02:34:02.000000000 +0200
@@ -20,9 +20,9 @@
 
 /**
  *      \file       htdocs/adherents/liste.php
- *      \ingroup    member
- *             \brief      Page to list all members of foundation
- *             \version    $Id: liste.php,v 1.69 2009/10/10 16:00:37 eldy Exp $
+ *      \ingroup    adherent
+ *             \brief      Page to list all members of fundation
+ *             \version    $Id: liste.php,v 1.62 2009/02/20 22:53:24 eldy Exp $
  */
 
 require("./pre.inc.php");
@@ -65,7 +65,7 @@
  * View
  */
 
-llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader();
 
 $form=new Form($db);
 
@@ -177,18 +177,18 @@
     
print_liste_field_titre($langs->trans("Person"),"liste.php","d.morphy",$param,"","",$sortfield,$sortorder);
     
print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email",$param,"","",$sortfield,$sortorder);
     
print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
-    
print_liste_field_titre($langs->trans("EndSubscription"),"liste.php","d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
-    
print_liste_field_titre($langs->trans("Action"),"liste.php","",$param,"",'width="60"
 align="center"',$sortfield,$sortorder);
+    
print_liste_field_titre($langs->trans("EndSubscription"),"liste.php","d.datefin",$param,"","",$sortfield,$sortorder);
+    print '<td width="60" align="center">'.$langs->trans("Action")."</td>\n";
     print "</tr>\n";
 
        // Lignes des champs de filtre
        print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
        print '<tr class="liste_titre">';
 
-       print '<td class="liste_titre" align="left">';
+       print '<td align="left">';
        print '<input class="flat" type="text" name="search_nom" 
value="'.$_REQUEST["search_nom"].'" size="12"></td>';
 
-       print '<td class="liste_titre" align="left">';
+       print '<td align="left">';
        print '<input class="flat" type="text" name="search_login" 
value="'.$_REQUEST["search_login"].'" size="7"></td>';
 
        print '<td class="liste_titre">';
@@ -198,7 +198,7 @@
 
        print '<td class="liste_titre">&nbsp;</td>';
 
-       print '<td class="liste_titre" align="left">';
+       print '<td align="left">';
        print '<input class="flat" type="text" name="search_email" 
value="'.$_REQUEST["search_email"].'" size="12"></td>';
 
        print '<td class="liste_titre">&nbsp;</td>';
@@ -247,27 +247,27 @@
         print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
 
         // Statut
-        print '<td nowrap="nowrap">';
+        print "<td>";
         print 
$adh->LibStatut($objp->statut,$objp->cotisation,$objp->datefin,2);
         print "</td>";
 
         // Date fin cotisation
         if ($objp->datefin)
         {
-               print '<td align="center" nowrap="nowrap">';
+               print '<td align="center">';
             if ($objp->datefin < time() && $objp->statut > 0)
             {
-                print dol_print_date($objp->datefin,'day')." 
".img_warning($langs->trans("SubscriptionLate"));
+                print dol_print_date($objp->datefin)." 
".img_warning($langs->trans("SubscriptionLate"));
             }
             else
             {
-                print dol_print_date($objp->datefin,'day');
+                print dol_print_date($objp->datefin);
             }
             print '</td>';
         }
         else
         {
-               print '<td align="left" nowrap="nowrap">';
+               print '<td align="left">';
                if ($objp->cotisation == 'yes')
                {
                 print $langs->trans("SubscriptionNotReceived");
@@ -301,7 +301,7 @@
 
        if ($num > $conf->liste_limit)
        {
-           
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'');
+           
print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
        }
 }
 else
@@ -312,5 +312,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:37 $ - $Revision: 1.69 $');
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.62 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/note.php me/htdocs/adherents/note.php
--- dolibarr-snapshot/htdocs/adherents/note.php 2009-10-10 18:07:01.000000000 
+0200
+++ me/htdocs/adherents/note.php        2009-04-27 02:34:02.000000000 +0200
@@ -18,10 +18,10 @@
  */
 
 /**
- *      \file       htdocs/adherents/note.php
- *      \ingroup    member
- *      \brief      Fiche de notes sur un adherent
- *             \version    $Id: note.php,v 1.20 2009/10/10 16:00:39 eldy Exp $
+        \file       htdocs/adherents/note.php
+        \ingroup    member
+        \brief      Fiche de notes sur un adherent
+               \version    $Id: note.php,v 1.14 2009/02/20 22:53:24 eldy Exp $
 */
 
 require("./pre.inc.php");
@@ -50,7 +50,7 @@
 if ($_POST["action"] == 'update' && $user->rights->adherent->creer && ! 
$_POST["cancel"])
 {
        $db->begin();
-
+       
        $res=$adh->update_note($_POST["note"],$user);
        if ($res < 0)
        {
@@ -65,25 +65,24 @@
 
 
 
-/*
- * View
- */
+/******************************************************************************/
+/* Affichage fiche                                                            
*/
+/******************************************************************************/
 
-llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader();
 
 $html = new Form($db);
 
 if ($id)
 {
        $head = member_prepare_head($adh);
-
-       dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user');
+       
+       dol_fiche_head($head, 'note', $langs->trans("Member"));
 
        if ($msg) print '<div class="error">'.$msg.'</div>';
 
        print "<form method=\"post\" action=\"note.php\">";
-       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
-
+       
     print '<table class="border" width="100%">';
 
     // Reference
@@ -140,7 +139,7 @@
     print "</table>";
        print "</form>\n";
 
-
+       
     /*
     * Actions
     */
@@ -159,5 +158,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:39 $ - $Revision: 1.20 $');
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.14 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/options.php me/htdocs/adherents/options.php
--- dolibarr-snapshot/htdocs/adherents/options.php      2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/options.php     2009-10-18 23:47:10.000000000 +0200
@@ -18,11 +18,10 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-/**
- *      \file       htdocs/adherents/options.php
- *             \ingroup    member
- *             \brief      Page de configuratin des champs optionnels
- *             \version    $Id: options.php,v 1.27 2009/10/10 16:00:36 eldy 
Exp $
+/**     \file       htdocs/adherents/options.php
+ \ingroup    adherent
+ \brief      Page de configuratin des champs optionnels
+ \version    $Id: options.php,v 1.22 2009/01/26 23:58:37 eldy Exp $
  */
 
 require("./pre.inc.php");
@@ -36,7 +35,6 @@
 /*
  * Actions
  */
-
 if ($_POST["action"] == 'add' && $user->rights->adherent->configurer)
 {
        if ($_POST["button"] != $langs->trans("Cancel"))
@@ -44,16 +42,14 @@
                // Type et taille non encore pris en compte => varchar(255)
                if (isset($_POST["attrname"]) && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
                {
-                       
$adho->create($_POST['attrname'],$_POST['type'],$_POST['size']);
+                       
$adho->create($_POST['attrname'],$_POST['type'],$_POST['size'],$_POST['table']);
                        if (isset($_POST['label']))
                        {
-                               
$adho->create_label($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$_POST['size']);
+                               
$adho->create_label($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$_POST['size'],$_POST['table']);
                        }
                        Header("Location: ".$_SERVER["PHP_SELF"]);
                        exit;
-               }
-               else
-               {
+               } else {
                        $langs->load("errors");
                        
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
                        $_GET["action"] = 'create';
@@ -61,16 +57,35 @@
        }
 }
 
+if ($_POST["action"] == 'addtbl' && $user->rights->adherent->configurer)
+{
+       if ($_POST["button"] != $langs->trans("Cancel"))
+       {
+               // Type et taille non encore pris en compte => varchar(255)
+               if (isset($_POST['label']))
+               {
+                       if ($adho->create_attrtable($_POST['label'])) {
+                               Header("Location: ".$_SERVER["PHP_SELF"]);
+                       } else {
+                               $langs->load("errors");
+                               
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
+                               $_GET["action"] = 'createtbl';
+                       }
+               }
+       }
+}
+
 if ($_POST["action"] == 'update' && $user->rights->adherent->configurer)
 {
        if ($_POST["button"] != $langs->trans("Cancel"))
        {
                if (isset($_POST["attrname"]) && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
                {
+                       if (!isset($_POST['size'])||($_POST['size'] < 1)) 
$_POST['size'] = 1;
                        
$adho->update($_POST['attrname'],$_POST['type'],$_POST['size']);
                        if (isset($_POST['label']))
                        {
-                               
$adho->update_label($_POST['attrname'],$_POST['label']);
+                               
$adho->update_label($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['size']);
                        }
                        Header("Location: ".$_SERVER["PHP_SELF"]);
                        exit;
@@ -86,9 +101,9 @@
 # Suppression attribut
 if ($_GET["action"] == 'delete' && $user->rights->adherent->configurer)
 {
-       if(isset($_GET["attrname"]) && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$_GET["attrname"]))
+       if(isset($_GET['attrname']) && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$_GET['attrname']))
        {
-               $adho->delete($_GET["attrname"]);
+               $adho->delete($_GET['attrname']);
                Header("Location: ".$_SERVER["PHP_SELF"]);
                exit;
        }
@@ -99,56 +114,81 @@
        }
 }
 
+# Suppression table attribut
+if ($_POST["action"] == 'deletetbl' && $user->rights->adherent->configurer)
+{
+       $adho->drop_table($_POST['tablenum']);
+}
+
+if ($_POST["action"] == 'updtbl' && $user->rights->adherent->configurer)
+{
+       $adho->update_table($_POST['tablenum'], $_POST['label']);
+}
+
 
 
 /*
  * View
  */
 
-llxHeader('',$langs->trans("OptionalFieldsSetup"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader();
 
 
-print_titre($langs->trans("OptionalFieldsSetup"));
-print '<br>';
 
 if ($mesg) print '<div class="error">'.$mesg.'</div><br>';
 
-// Load attribute_label
-$adho->fetch_name_optionals_label();
-
-print "<table class=\"noborder\" width=\"100%\">";
-
-print '<tr class="liste_titre">';
-print '<td>'.$langs->trans("Label").'</td>';
-print '<td>'.$langs->trans("AttributeCode").'</td>';
-print '<td>'.$langs->trans("Type").'</td><td width="80">&nbsp;</td>';
-print "</tr>\n";
-
-$var=True;
-foreach($adho->attribute_name as $key => $value)
-{
-       $var=!$var;
-       print "<tr $bc[$var]>";
-       print "<td>".$adho->attribute_label[$key]."&nbsp;</td>\n";
-       print "<td>$key</td>\n";
-       print "<td>$value</td>\n";
-       print "<td align=\"right\"><a 
href=\"options.php?action=edit&attrname=$key\">".img_edit()."</a>";
-       print "&nbsp; <a 
href=\"options.php?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
-       print "</tr>";
-       //      $i++;
+// Load attribute_definition
+$LesTables = fetch_optionals_table(1);
+while (list($tablenum, $tablelabel) = each($LesTables))
+{
+       print '<br>';
+       if ($tablenum == 0) {
+               print_titre($langs->trans("OptionalFieldsSetup"));
+       } else {
+               $lien = "<a 
href=\"options.php?action=edittbl&tablenum=$tablenum\">".img_edit()."</a>&nbsp;"
+                       ."<a 
href=\"options.php?action=confdeltbl&tablenum=$tablenum\">".img_delete()."</a>&nbsp;";
+               print_titre($lien.$langs->trans("OptionalFieldsTable", 
$LesTables[$tablenum]));
+       }
+       
+       $adho->fetch_name_optionals_def($tablenum);
+       print "<table class=\"noborder\" width=\"100%\">";
+       print '<tr class="liste_titre">';
+       print '<td width="40%">'.$langs->trans("Label").'</td>';
+       print '<td width="25%">'.$langs->trans("AttributeCode").'</td>';
+       print '<td width="25%">'.$langs->trans("Type").'</td><td 
width="10%">&nbsp;</td>';
+       print "</tr>\n";
+       $var=True;
+       while (list($key, $option) = each($adho->attribute_definition)) {
+               $var=!$var;
+               print "<tr $bc[$var]>";
+               print "<td>".$option['label']."&nbsp;</td>\n";
+               print "<td>$key</td>\n";
+               print '<td>'.$option['type'].'</td>'."\n";
+               print "<td align=\"right\"><a 
href=\"options.php?action=edit&attrname=$key\">".img_edit()."</a>";
+               print "&nbsp; <a 
href=\"options.php?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
+               print "</tr>";
+               //      $i++;
+       }
+       print "</table>";
 }
 
-print "</table>";
-
 /*
  * Barre d'actions
  *
  */
-if ($_GET["action"] != 'create')
+switch($_GET["action"])
 {
-       print '<div class="tabsAction">';
-       print "<a class=\"butAction\" 
href=\"options.php?action=create\">".$langs->trans("NewAttribute")."</a>";
-       print "</div>";
+       case 'create':
+       case 'createtbl':
+       case 'edit':
+       case 'editbl':
+       case 'confdeltbl':
+               break;
+       default:
+               print '<div class="tabsAction">';
+               print "<a class=\"butAction\" 
href=\"options.php?action=createtbl\">".$langs->trans("NewAttributeTable")."</a>";
+               print "<a class=\"butAction\" 
href=\"options.php?action=create\">".$langs->trans("NewAttribute")."</a>";
+               print "</div>";
 }
 
 
@@ -160,12 +200,11 @@
 
 if ($_GET["action"] == 'create')
 {
-       print "<br>";
+       print '<br><hr />';
 
        print_titre($langs->trans('NewAttribute'));
 
        print '<form action="options.php" method="post">';
-       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
        print '<table class="border" width="100%">';
 
        print '<input type="hidden" name="action" value="add">';
@@ -180,6 +219,47 @@
        'datetime'=>$langs->trans('DateAndTime')));
        print '</td></tr>';
        print '<tr><td>Taille</td><td><input type="text" name="size" size="5" 
value="255"></td></tr>';
+       print '<tr><td>Tableau</td><td>';
+       $les_tables = fetch_optionals_table(1);
+       $form->select_array('table',$les_tables);
+       print '</td></tr>';
+       print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+       print "</form>\n";
+       print "</table>\n";
+}
+
+if ($_GET["action"] == 'createtbl')
+{
+       print '<br><hr />';
+
+       print_titre($langs->trans('NewAttributeTable'));
+
+       print '<form action="options.php" method="post">';
+       print '<table class="border" width="100%">';
+
+       print '<input type="hidden" name="action" value="addtbl">';
+
+       print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur"><input 
type="text" name="label" size="40"></td></tr>';
+
+       print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+       print "</form>\n";
+       print "</table>\n";
+}
+
+if ($_GET["action"] == 'edittbl')
+{
+       print '<br><hr />';
+
+       print_titre($langs->trans('UpdAttributeTable'));
+
+       print '<form action="options.php" method="post">';
+       print '<table class="border" width="100%">';
+       print '<input type="hidden" name="tablenum" 
value="'.$_GET['tablenum'].'">';
+       print '<input type="hidden" name="action" value="updtbl">';
+
+       print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur"><input 
type="text" name="label" size="40" 
value="'.$LesTables[$_GET['tablenum']].'"></td></tr>';
 
        print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
        print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
@@ -192,32 +272,32 @@
 /* Edition d'un champ optionnel                                               
*/
 /*                                                                            
*/
 /* ************************************************************************** 
*/
-if ($_GET["attrname"] && $_GET["action"] == 'edit')
+if ($_GET['attrname'] && $_GET["action"] == 'edit')
 {
+       print '<br><hr />';
 
-       print_titre($langs->trans("FieldEdition",$_GET["attrname"]));
+       print_titre($langs->trans("FieldEdition",$_GET['attrname']));
 
        /*
         * formulaire d'edition
         */
-       print '<form method="post" 
action="options.php?attrname='.$_GET["attrname"].'">';
-       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
-       print '<input type="hidden" name="attrname" 
value="'.$_GET["attrname"].'">';
+       print '<form method="post" 
action="options.php?attrname='.$_GET['attrname'].'">';
+       print '<input type="hidden" name="attrname" 
value="'.$_GET['attrname'].'">';
        print '<input type="hidden" name="action" value="update">';
        print '<table class="border" width="100%">';
 
-       print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur"><input 
type="text" name="label" size="40" 
value="'.$adho->attribute_label[$_GET["attrname"]].'"></td></tr>';
-       print '<tr><td>'.$langs->trans("AttributeName").'</td><td 
class="valeur">'.$_GET["attrname"].'&nbsp;</td></tr>';
-       
list($type,$size)=preg_split('/\(|\)/',$adho->attribute_name[$_GET["attrname"]]);
+       print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur"><input 
type="text" name="label" size="40" 
value="'.$adho->attribute_definition[$_GET['attrname']]['label'].'"></td></tr>';
+       print '<tr><td>'.$langs->trans("AttributeName").'</td><td 
class="valeur">'.$_GET['attrname'].'&nbsp;</td></tr>';
+       
list($type,$size)=preg_split('/\(|\)/',$adho->attribute_name[$_GET['attrname']]);
        print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">';
        $form->select_array('type',array('varchar'=>$langs->trans('String'),
        'text'=>$langs->trans('Text'),
        'int'=>$langs->trans('Int'),
        'date'=>$langs->trans('Date'),
-       'datetime'=>$langs->trans('DateAndTime')),$type);
+       
'datetime'=>$langs->trans('DateAndTime')),$adho->attribute_definition[$_GET['attrname']]['type']);
        print '</td></tr>';
 
-       print '<tr><td>'.$langs->trans("Size").'</td><td class="valeur"><input 
type="text" name="size" size="5" value="'.$size.'"></td></tr>';
+       print '<tr><td>'.$langs->trans("Size").'</td><td class="valeur"><input 
type="text" name="size" size="5" 
value="'.$adho->attribute_definition[$_GET['attrname']]['size'].'"></td></tr>';
        print '<tr><td colspan="2" align="center"><input type="submit" 
class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
        print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
        print '</table>';
@@ -225,7 +305,22 @@
 
 }
 
+if ($_GET['tablenum'] && $_GET['action'] == 'confdeltbl')
+{
+       print '<br><hr />';
+
+       
print_titre($langs->trans('ConfirmDelAttrTbl'),$LesTables[$_GET['tablenum']]);
+
+       print '<form action="options.php" method="post">';
+       print '<table class="border" width="100%">';
+       print '<input type="hidden" name="tablenum" 
value="'.$_GET['tablenum'].'">';
+       print '<input type="hidden" name="action" value="deletetbl">';
+       print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+       print "</form>\n";
+       print "</table>\n";
+}
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:36 $ - $Revision: 1.27 $');
+llxFooter('$Date: 2009/01/26 23:58:37 $ - $Revision: 1.22 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/plus.php me/htdocs/adherents/plus.php
--- dolibarr-snapshot/htdocs/adherents/plus.php 1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/adherents/plus.php        2009-10-18 21:58:08.000000000 +0200
@@ -0,0 +1,250 @@
+<?php
+/* Copyright (C) 2009      Thibaut des ABBAYES <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+        \file       htdocs/adherents/plus.php
+        \ingroup    adherents
+        \brief      onglet d'informations en tableau sur un adherent
+               \version    $Id: plus.php,v 1.1 2009-09-12 06:39:20 tibo Exp $
+*/
+$err='gérer l ordre de tri maintenant que les liens sont OK';
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT.'/lib/member.lib.php');
+require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
+require_once(DOL_DOCUMENT_ROOT.'/adherents/adherent_option_table.class.php');
+
+$action=isset($_GET["action"])?$_GET["action"]:(isset($_POST["action"])?$_POST["action"]:'');
+$do_it=isset($_GET["do_it"])?$_GET["do_it"]:(isset($_POST["do_it"])?$_POST["do_it"]:'');
+$id=isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:'');
+$sortorder=isset($_GET['sortorder'])?$_GET['sortorder']:$_POST['sortorder'];
+$tablenum=isset($_GET['tablenum'])?$_GET['tablenum']:$_POST['tablenum'];
+$linenum=isset($_GET['linenum'])?$_GET['linenum']:$_POST['linenum'];
+
+$langs->load("companies");
+$langs->load("members");
+$langs->load("bills");
+
+if (!$user->rights->adherent->lire)
+  accessforbidden();
+
+
+/******************************************************************************/
+/*                     Actions                                                
*/
+/******************************************************************************/
+
+if ($user->rights->adherent->creer && ($_POST['do_it'] == 1) && ! 
$_POST["cancel"])
+{
+       $db->begin();
+
+    $adho = new AdherentOptionTable($_POST['tablenum']);
+
+    switch ($action)
+    {
+        case 'create':
+            // Execute le SQL d'insertion
+            $resu = $adho->insert_plus();
+            break;
+        case 'edit':
+            // Execute le SQL de mise à jour
+            $resu = $adho->update_plus();
+            break;
+        case 'delete':
+            // Execute le SQL d'effacement
+            $resu = $adho->delete_plus();
+            break;
+        default:
+            die('XXX '.$action);
+    }
+    $action = 'select';
+    
+    // Gère les erreurs d'exécution
+    if ($res < 0)
+       {
+               $mesg='<div class="error">'.$res.'</div>';
+               $db->rollback();
+       }
+       else
+       {
+               $db->commit();
+        $action='select';
+        $do_it=0;
+       }
+}
+
+
+
+/******************************************************************************/
+/* Affichage fiche                                                            
*/
+/******************************************************************************/
+
+$adh = new Adherent($db);
+$adh->id = $id;
+$adh->fetch($id);
+
+llxHeader();
+
+$html = new Form($db);
+
+if ($id)
+{
+       $head = member_prepare_head($adh);
+       dol_fiche_head($head, 'plus', $langs->trans("MemberPlus"));
+       if ($msg) print '<div class="error">'.$msg.'</div>';
+
+    print "<form method=\"post\" action=\"plus.php\">";
+    switch($action)
+    {
+        case '':
+        case 'select':
+            // Affiche le select
+            affiche_le_select($id);
+            break;
+        case 'edit':
+            // Affiche le update
+            affiche_le_update($id, $tablenum, $linenum);
+            break;
+        case 'create':
+            // Affiche le insert
+            affiche_le_create($id, $tablenum);
+            break;
+        case 'delete':
+            // Affiche le confirm du delete
+            affiche_le_delete($id, $tablenum, $linenum);
+            break;
+
+    }
+    print "</form>";
+}
+
+$db->close();
+
+llxFooter('$Date: 2009-09-12 06:39:20 $ - $Revision: 1.1 $');
+
+
+
+function affiche_le_select($id)
+{
+    global $db, $langs, $user, $sortorder;
+    // Liste des tableaux
+       $tbls = fetch_optionals_table();
+       while (list($tableau_id, $label) = each($tbls))
+       {
+               $tablo = new AdherentOptionTable($tableau_id);
+               $tablo->GetData($id, $sortorder);
+               // Affiche le titre
+               print '<div class="titre">'.$tablo->titre.'</div>';
+               // Affiche l'entête
+               print '<table class="noborder" width="100%">';
+               print '<tr class="liste_titre">';
+               reset($tablo->arr_fields);
+               while (list($k,$f) = each($tablo->arr_fields))
+               {
+                       
print_liste_adh_plus_titre($f['label'],'plus.php?id='.$id, $tableau_id,$k+1, 
$sortorder);
+               }
+               print '<td width="60" 
align="center">'.$langs->trans("Action")."</td>\n";
+               print "</tr>\n";
+
+               // Affiche les données
+               reset($tablo->arr_data);
+               $parite=0;
+               while (list($k,$l) = each($tablo->arr_data))
+               {
+                       print ($parite++ % 2) ? '<tr class="pair">':'<tr 
class="impair">';
+                       while (list($j,$v) = each($l))
+                               print '<td>'.$v.'</td>';
+                       // Colonne action
+                       // Actions
+                       print '<td align="center">';
+                       if ($user->rights->adherent->creer)
+                       {
+                               print "<a 
href=\"plus.php?action=edit&sortorder=$sortorder&id=$id&tablenum=$tableau_id&linenum=".$k."\">".img_edit()."</a>";
+                       }
+                       print '&nbsp;';
+                       if ($user->rights->adherent->supprimer)
+                       {
+                               print "<a 
href=\"plus.php?action=delete&sortorder=$sortorder&id=$id&tablenum=$tableau_id&linenum=".$k."\">".img_picto($langs->trans("Delete"),'delete.png')."</a>";
+                       }
+                       print "</td>";
+                       print '</tr>';
+               }
+               if ($user->rights->adherent->creer)
+               {
+                       print '</table>';
+                       print '<div class="tabsAction">';
+                       print "<a class=\"butAction\" 
href=\"plus.php?action=create&sortorder=$sortorder&id=$id&tablenum=$tableau_id\">".$langs->trans("New")."</a>";
+                       print "</div>";
+               }
+       }
+}
+
+
+
+function affiche_le_create($id, $tablenum)
+{
+    affiche_le_update($id, $tablenum);
+}
+
+function affiche_le_update($id, $tablenum, $linenum = 0)
+{
+    global $langs, $user, $sortorder, $action;
+
+    $tablo = new AdherentOptionTable($tablenum);
+    if ($linenum != 0)
+    {
+        $tablo->GetData($id, $sortorder);
+        $libmode = 'Modifier';
+    } else {
+        $libmode = 'Ajouter';
+    }
+    reset($tablo->arr_fields);
+    print '<div class="titre">'.$libmode.'&nbsp;'.$tablo->titre.'</div>';
+       print '<center>';
+    print '<input type="hidden" name="do_it" value="1">';
+    print '<input type="hidden" name="action" value="'.$action.'">';
+    print '<input type="hidden" name="id" value="'.$id.'">';
+    print '<input type="hidden" name="tablenum" value="'.$tablenum.'">';
+    print '<input type="hidden" name="linenum" value="'.$linenum.'">';
+    print '<table width="80%" class="border">';
+    while (list($k,$champ) = each($tablo->arr_fields))
+        print adhplus_input($champ, 
$tablo->arr_data[$linenum][$champ['name']]);
+    print '</table>';
+    print '<br /><input type="submit" class="button" 
value="'.$libmode.'&nbsp;'.$tablo->titre.'"></center>';
+}
+
+function affiche_le_delete($id, $tablenum, $linenum = 0)
+{
+    global $langs, $user, $sortorder, $action;
+
+    $tablo = new AdherentOptionTable($tablenum);
+    $tablo->GetData($id, $sortorder);
+    $libmode = 'Supprimer';
+    reset($tablo->arr_fields);
+    print '<div class="titre">'.$libmode.'&nbsp;'.$tablo->titre.'</div>';
+       print '<center>';
+    print '<input type="hidden" name="do_it" value="1">';
+    print '<input type="hidden" name="action" value="'.$action.'">';
+    print '<input type="hidden" name="id" value="'.$id.'">';
+    print '<input type="hidden" name="tablenum" value="'.$tablenum.'">';
+    print '<input type="hidden" name="linenum" value="'.$linenum.'">';
+    print '<table class="border">';
+    while (list($k,$champ) = each($tablo->arr_fields))
+        print 
'<tr><td>'.$champ['label'].'</td><td>'.$tablo->arr_data[$linenum][$champ['name']].'</td></tr>';
+    print '</table>';
+    print '<br /><input type="submit" class="button" value="Confirmer la 
suppression"></center>';
+}
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/pre.inc.php me/htdocs/adherents/pre.inc.php
--- dolibarr-snapshot/htdocs/adherents/pre.inc.php      2009-10-10 
18:07:01.000000000 +0200
+++ me/htdocs/adherents/pre.inc.php     2009-04-27 02:34:02.000000000 +0200
@@ -18,10 +18,10 @@
  */
 
 /**     \file       htdocs/adherents/pre.inc.php
- *      \ingroup    member
- *             \brief      Fichier de gestion du menu gauche du module adherent
- *             \version    $Id: pre.inc.php,v 1.31 2009/10/10 16:00:39 eldy 
Exp $
- */
+        \ingroup    adherent
+               \brief      Fichier de gestion du menu gauche du module adherent
+               \version    $Id: pre.inc.php,v 1.29 2009/03/09 11:28:13 eldy 
Exp $
+*/
 
 require("../main.inc.php");
 
@@ -31,7 +31,7 @@
 
        $langs->load("members");
 
-       top_menu($head, $title);
+       top_menu($head);
 
        $menu = new Menu();
 
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/public.php me/htdocs/adherents/public.php
--- dolibarr-snapshot/htdocs/adherents/public.php       2009-10-22 
03:05:22.000000000 +0200
+++ me/htdocs/adherents/public.php      2009-04-27 02:34:02.000000000 +0200
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2001-2002 Rodolphe Quiedeville <address@hidden>
- * Copyright (C) 2006-2009 Laurent Destailleur  <address@hidden>
+ * Copyright (C) 2006-2008 Laurent Destailleur  <address@hidden>
  *
  * 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
@@ -18,12 +18,12 @@
  */
 
 /**
- *             \file       htdocs/adherents/public.php
- *             \ingroup    member
- *             \brief      Fichier de la page de l'espace publique adherent
- *             \author     Laurent Destailleur
- *             \version    $Id: public.php,v 1.8 2009/10/20 14:22:24 hregis 
Exp $
- */
+               \file       htdocs/adherents/public.php
+               \ingroup    member
+               \brief      Fichier de la page de l'espace publique adherent
+               \author     Laurent Destailleur
+               \version    $Id: public.php,v 1.6 2009/02/11 20:44:02 eldy Exp $
+*/
 
 require("./pre.inc.php");
 
@@ -47,12 +47,12 @@
 
 print '<table class="border" cellspacing="0" cellpadding="3">';
 print '<tr 
class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
+print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td><a 
target="_blank" 
href="'.DOL_URL_ROOT.'/public/members/new.php'.'">'.$dolibarr_main_url_root.DOL_URL_ROOT.'/public/members/new.php'.'</a></td></tr>';
+print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td><a 
target="_blank" 
href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.$dolibarr_main_url_root.DOL_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
 // Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
 $firstpart=$dolibarr_main_url_root;
-$regex='/'.DOL_URL_ROOT.'$/i';
-$firstpart=preg_replace($regex,'',$firstpart);
-print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td><a 
target="_blank" 
href="'.DOL_URL_ROOT.'/public/members/new.php'.'">'.$firstpart.DOL_URL_ROOT.'/public/members/new.php'.'</a></td></tr>';
-print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td><a 
target="_blank" 
href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.$firstpart.DOL_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
+$regex=DOL_URL_ROOT.'$';
+$firstpart=eregi_replace($regex,'',$firstpart);
 print 
'<tr><td>'.$langs->trans("PublicMemberCard").'</td><td>'.$firstpart.DOL_URL_ROOT.'/public/members/public_card.php?id=xxx'.'</td></tr>';
 print '</table>';
 
@@ -62,5 +62,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/20 14:22:24 $ - $Revision: 1.8 $');
+llxFooter('$Date: 2009/02/11 20:44:02 $ - $Revision: 1.6 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/adherents/type.php me/htdocs/adherents/type.php
--- dolibarr-snapshot/htdocs/adherents/type.php 2009-10-10 18:07:01.000000000 
+0200
+++ me/htdocs/adherents/type.php        2009-04-27 02:34:02.000000000 +0200
@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2001-2002 Rodolphe Quiedeville <address@hidden>
  * Copyright (C) 2003      Jean-Louis Bergamo   <address@hidden>
- * Copyright (C) 2004-2009 Laurent Destailleur  <address@hidden>
+ * Copyright (C) 2004-2008 Laurent Destailleur  <address@hidden>
  *
  * 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
@@ -19,11 +19,11 @@
  */
 
 /**
- *      \file       htdocs/adherents/type.php
- *      \ingroup    member
- *             \brief      Page de configuration des types d'adherents
- *             \version    $Id: type.php,v 1.55 2009/10/10 16:00:37 eldy Exp $
- */
+        \file       htdocs/adherents/type.php
+        \ingroup    adherent
+               \brief      Page de configuration des types d'adhérents
+               \version    $Id: type.php,v 1.47 2009/02/20 22:53:24 eldy Exp $
+*/
 
 require("./pre.inc.php");
 require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
@@ -37,12 +37,12 @@
 /*
 *      Actions
 */
-if ($user->rights->adherent->configurer && $_POST["action"] == 'add')
+if ($user->rights->adherent->configurer && $_POST["action"] == 'add') 
 {
     if ($_POST["button"] != $langs->trans("Cancel"))
     {
         $adht = new AdherentType($db);
-
+          
         $adht->libelle     = trim($_POST["libelle"]);
         $adht->cotisation  = trim($_POST["cotisation"]);
         $adht->note        = trim($_POST["comment"]);
@@ -71,7 +71,7 @@
     }
 }
 
-if ($user->rights->adherent->configurer && $_POST["action"] == 'update')
+if ($user->rights->adherent->configurer && $_POST["action"] == 'update') 
 {
     if ($_POST["button"] != $langs->trans("Cancel"))
     {
@@ -82,12 +82,12 @@
         $adht->note        = trim($_POST["comment"]);
         $adht->mail_valid  = trim($_POST["mail_valid"]);
         $adht->vote        = trim($_POST["vote"]);
-
+        
         $adht->update($user->id);
 
         Header("Location: type.php?rowid=".$_POST["rowid"]);
         exit;
-    }
+    }    
 }
 
 if ($user->rights->adherent->configurer && $_GET["action"] == 'delete')
@@ -106,37 +106,35 @@
 }
 
 
-/*
- * View
- */
 
-llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
+llxHeader();
 
 $form=new Form($db);
 
 /* ************************************************************************** 
*/
 /*                                                                            
*/
-/* Liste des types d'adh�rents                                               
 */
+/* Liste des types d'adhérents                                                
*/
 /*                                                                            
*/
 /* ************************************************************************** 
*/
 
 if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit')
 {
 
-    print_fiche_titre($langs->trans("MembersTypeSetup"));
+    print_titre($langs->trans("MembersTypeSetup"));
+    print '<br>';
 
 
     $sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
     $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
-
+    
     $result = $db->query($sql);
-    if ($result)
+    if ($result) 
     {
       $num = $db->num_rows($result);
       $i = 0;
-
+      
       print '<table class="noborder" width="100%">';
-
+      
       print '<tr class="liste_titre">';
       print '<td>'.$langs->trans("Ref").'</td>';
       print '<td>'.$langs->trans("Label").'</td>';
@@ -144,7 +142,7 @@
       print '<td align="center">'.$langs->trans("VoteAllowed").'</td>';
          print '<td>&nbsp;</td>';
       print "</tr>\n";
-
+      
       $var=True;
       while ($i < $num)
         {
@@ -186,24 +184,24 @@
 
 /* ************************************************************************** 
*/
 /*                                                                            
*/
-/* Cr�ation d'un type adherent                                               
 */
+/* Création d'un type adherent                                                
*/
 /*                                                                            
*/
 /* ************************************************************************** 
*/
 if ($_GET["action"] == 'create')
 {
        $htmls = new Form($db);
 
-       print_fiche_titre($langs->trans("NewMemberType"));
+       print_titre($langs->trans("NewMemberType"));
+       print '<br>';
 
        if ($mesg) print '<div class="error">'.$mesg.'</div>';
 
        print "<form action=\"type.php\" method=\"post\">";
-       print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
        print '<table class="border" width="100%">';
 
        print '<input type="hidden" name="action" value="add">';
 
-       print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" 
name="libelle" size="40"></td></tr>';
+       print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" 
name="libelle" size="40"></td></tr>';  
 
        print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
        print $htmls->selectyesno("cotisation",1,1);
@@ -236,7 +234,7 @@
 
        print "</form>\n";
        print "</table>\n";
-}
+} 
 /* ************************************************************************** 
*/
 /*                                                                            
*/
 /* Edition de la fiche                                                        
*/
@@ -252,40 +250,40 @@
 
 
         $h=0;
-
+        
         $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
         $head[$h][1] = $langs->trans("Card");
         $head[$h][2] = 'card';
         $h++;
 
-        dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
+        dol_fiche_head($head, 'card', $langs->trans("MemberType"));
 
 
         print '<table class="border" width="100%">';
-
+        
         // Ref
                print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
                print '<td>';
                print $form->showrefnav($adht,'rowid');
-               print '</td></tr>';
-
+               print '</td></tr>';  
+               
         // Label
-               print '<tr><td 
width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';
-
+               print '<tr><td 
width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';  
+        
         print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
         print yn($adht->cotisation);
         print '</tr>';
-
+        
         print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
         print yn($adht->vote);
         print '</tr>';
-
+        
         print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
         print nl2br($adht->note)."</td></tr>";
-
+        
         print '<tr><td 
valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
         print nl2br($adht->mail_valid)."</td></tr>";
-
+        
         print '</table>';
 
         print '</div>';
@@ -301,7 +299,7 @@
                {
                        print "<a class=\"butAction\" 
href=\"type.php?action=edit&amp;rowid=".$adht->id."\">".$langs->trans("Modify")."</a>";
                }
-
+       
                // Add
            print "<a class=\"butAction\" 
href=\"fiche.php?action=create&typeid=".$adht->id."\">".$langs->trans("AddMember")."</a>";
 
@@ -310,50 +308,49 @@
                {
                        print "<a class=\"butActionDelete\" 
href=\"type.php?action=delete&rowid=".$adht->id."\">".$langs->trans("DeleteType")."</a>";
                }
-
+               
         print "</div>";
     }
-
+    
     if ($_GET["action"] == 'edit')
     {
         $htmls = new Form($db);
-
+        
         $adht = new AdherentType($db);
         $adht->id = $rowid;
         $adht->fetch($rowid);
 
 
         $h=0;
-
+        
         $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
         $head[$h][1] = $langs->trans("Card");
         $head[$h][2] = 'card';
         $h++;
 
-        dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
+        dol_fiche_head($head, 'card', $langs->trans("MemberType"));
 
 
         print '<form method="post" 
action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">';
-        print '<input type="hidden" name="token" 
value="'.$_SESSION['newtoken'].'">';
         print '<input type="hidden" name="rowid" value="'.$rowid.'">';
         print '<input type="hidden" name="action" value="update">';
         print '<table class="border" width="100%">';
+        
+        print '<tr><td 
width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';  
 
-        print '<tr><td 
width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';
-
-        print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" 
name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';
-
+        print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" 
name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';  
+        
         print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
         print $htmls->selectyesno("cotisation",$adht->cotisation,1);
         print '</td></tr>';
-
+        
         print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
         print $htmls->selectyesno("vote",$adht->vote,1);
         print '</td></tr>';
-
+        
         print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
         print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" 
rows=\"3\">".$adht->note."</textarea></td></tr>";
-
+        
         print '<tr><td 
valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
                if ($conf->fckeditor->enabled)
                {
@@ -368,10 +365,10 @@
                        print '</textarea>';
                }
         print "</td></tr>";
-
+        
         print '<tr><td colspan="2" align="center"><input type="submit" 
class="button" value="'.$langs->trans("Save").'"> &nbsp; &nbsp;';
         print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
-
+        
         print '</table>';
         print "</form>";
     }
@@ -379,5 +376,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2009/10/10 16:00:37 $ - $Revision: 1.55 $');
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.47 $');
 ?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/htdocs/conf/conf.php_ 
me/htdocs/conf/conf.php_
--- dolibarr-snapshot/htdocs/conf/conf.php_     1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/conf/conf.php_    2009-09-28 22:05:02.000000000 +0200
@@ -0,0 +1,23 @@
+<?php
+#
+# File generated by Dolibarr installer on 2009-09-28 22:05:02
+#
+# Take a look at conf.php.example file for an example of conf.php file
+# and explanations for all possibles parameters.
+#
+$dolibarr_main_url_root="http://localhost/dolibarr/htdocs";;
+$dolibarr_main_document_root="/var/www/dolibarr/htdocs";
+$dolibarr_main_data_root="/var/www/dolibarr/documents";
+$dolibarr_main_db_host="localhost";
+$dolibarr_main_db_port="";
+$dolibarr_main_db_name="dolibarr";
+$dolibarr_main_db_user="root";
+$dolibarr_main_db_pass="root";
+$dolibarr_main_db_type="mysqli";
+$dolibarr_main_db_character_set="latin1";
+$dolibarr_main_db_collation="latin1_swedish_ci";
+$dolibarr_main_authentication="dolibarr";
+$dolibarr_smarty_libs_dir="";
+$dolibarr_smarty_compile="";
+$dolibarr_smarty_cache="";
+?>
\ Pas de fin de ligne à la fin du fichier.
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/install/mysql/tables/llx_adherent_options_label.sql 
me/htdocs/install/mysql/tables/llx_adherent_options_label.sql
--- 
dolibarr-snapshot/htdocs/install/mysql/tables/llx_adherent_options_label.sql    
    2009-10-03 00:43:58.000000000 +0200
+++ me/htdocs/install/mysql/tables/llx_adherent_options_label.sql       
2009-10-07 20:18:08.000000000 +0200
@@ -16,7 +16,7 @@
 -- along with this program; if not, write to the Free Software
 -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 --
--- $Id: llx_adherent_options_label.sql,v 1.5 2008/12/18 20:32:27 hregis Exp $
+-- $Id: llx_adherent_options_label.sql,v 1.1 2009/10/07 18:18:08 eldy Exp $
 -- ===================================================================
 
 create table llx_adherent_options_label
@@ -26,6 +26,5 @@
        label           varchar(255) NOT NULL, -- label correspondant a 
l'attribut
        type            varchar(8),
        size            integer DEFAULT 0,
-        tablenum        tinyint NOT NULL DEFAULT 0, -- Numéro du tableau
        pos             integer DEFAULT 0
 )type=innodb;
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/htdocs/lib/info.php 
me/htdocs/lib/info.php
--- dolibarr-snapshot/htdocs/lib/info.php       1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/info.php      2009-04-27 02:34:02.000000000 +0200
@@ -0,0 +1,71 @@
+<?php
+/* Copyright (C) 2005-2006 Laurent Destailleur  <address@hidden>
+ * Copyright (C) 2005-2006 Regis Houssin        <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+        \file       htdocs/adherents/info.php
+        \ingroup    member
+               \brief      Page des informations d'un adherent
+               \version    $Id: info.php,v 1.8 2009/03/02 18:25:51 eldy Exp $
+*/
+
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
+
+$langs->load("companies");
+$langs->load("bills");
+$langs->load("members");
+$langs->load("users");
+
+if (!$user->rights->adherent->lire)
+       accessforbidden();
+
+
+/*
+ * Visualisation de la fiche
+ *
+ */
+
+llxHeader();
+
+$adh = new Adherent($db);
+$adh->id=$_GET["id"];
+$adh->fetch($_GET["id"]);
+$adh->info($_GET["id"]);
+
+/*
+ * Affichage onglets
+ */
+$head = member_prepare_head($adh);
+
+dol_fiche_head($head, 'info', $langs->trans("Member"));
+
+
+print '<table width="100%"><tr><td>';
+dol_print_object_info($adh);
+print '</td></tr></table>';
+
+print '</div>';
+
+
+$db->close();
+
+llxFooter('$Date: 2009/03/02 18:25:51 $ - $Revision: 1.8 $');
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/lib/info_subscription.php 
me/htdocs/lib/info_subscription.php
--- dolibarr-snapshot/htdocs/lib/info_subscription.php  1970-01-01 
01:00:00.000000000 +0100
+++ me/htdocs/lib/info_subscription.php 2009-04-27 02:34:02.000000000 +0200
@@ -0,0 +1,85 @@
+<?php
+/* Copyright (C) 2005-2006 Laurent Destailleur  <address@hidden>
+ * Copyright (C) 2005-2006 Regis Houssin        <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+        \file       htdocs/adherents/info.php
+        \ingroup    member
+               \brief      Page des informations d'un adherent
+               \version    $Id: info_subscription.php,v 1.6 2009/03/02 
18:25:51 eldy Exp $
+*/
+
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
+
+$langs->load("companies");
+$langs->load("bills");
+$langs->load("members");
+$langs->load("users");
+
+if (!$user->rights->adherent->lire)
+       accessforbidden();
+
+$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
+
+
+
+/*
+ * Visualisation de la fiche
+ *
+ */
+
+llxHeader();
+
+$form = new Form($db);
+
+$subscription = new Cotisation($db);
+$result=$subscription->fetch($rowid);
+
+$h = 0;
+$head = array();
+
+$head[$h][0] = 
DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id;
+$head[$h][1] = $langs->trans("SubscriptionCard");
+$head[$h][2] = 'general';
+$h++;
+
+$head[$h][0] = 
DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id;
+$head[$h][1] = $langs->trans("Info");
+$head[$h][2] = 'info';
+$h++;
+
+
+dol_fiche_head($head, 'info', $langs->trans("Subscription"));
+
+$subscription->info($rowid);
+
+print '<table width="100%"><tr><td>';
+dol_print_object_info($subscription);
+print '</td></tr></table>';
+
+print '</div>';
+
+
+$db->close();
+
+llxFooter('$Date: 2009/03/02 18:25:51 $ - $Revision: 1.6 $');
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/htdocs/lib/ldap.php 
me/htdocs/lib/ldap.php
--- dolibarr-snapshot/htdocs/lib/ldap.php       1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/ldap.php      2009-04-27 02:34:02.000000000 +0200
@@ -0,0 +1,205 @@
+<?php
+/* Copyright (C) 2006 Laurent Destailleur  <address@hidden>
+ * Copyright (C) 2006 Regis Houssin        <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+        \file       htdocs/adherents/ldap.php
+        \ingroup    ldap
+        \brief      Page fiche LDAP adherent
+        \version    $Id: ldap.php,v 1.17 2009/02/20 22:53:24 eldy Exp $
+*/
+
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/ldap.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
+
+$langs->load("companies");
+$langs->load("members");
+$langs->load("ldap");
+$langs->load("admin");
+
+// Protection quand utilisateur externe
+$rowid = isset($_GET["id"])?$_GET["id"]:'';
+
+$socid=0;
+if ($user->societe_id > 0)
+{
+    $socid = $user->societe_id;
+}
+
+
+/*
+ *     Affichage page
+ */
+
+llxHeader();
+
+$html = new Form($db);
+
+
+$adh = new Adherent($db);
+$adh->id = $rowid;
+$result=$adh->fetch($rowid);
+if (! $result)
+{
+       dol_print_error($db,"Failed to get adherent: ".$adh->error);
+       exit;
+}
+$adh->fetch_optionals($rowid);
+
+$adht = new AdherentType($db);
+$result=$adht->fetch($adh->typeid);
+if (! $result)
+{
+       dol_print_error($db,"Failed to get type of adherent: ".$adht->error);
+       exit;
+}
+
+
+
+/*
+ * Affichage onglets
+ */
+$head = member_prepare_head($adh);
+
+dol_fiche_head($head, 'ldap', $langs->trans("Member"));
+
+
+/*
+ * Fiche en mode visu
+ */
+print '<table class="border" width="100%">';
+
+// Ref
+print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
+print '<td class="valeur">';
+print $html->showrefnav($adh,'id');
+print '</td></tr>';
+
+// Nom
+print '<tr><td>'.$langs->trans("Lastname").'</td><td 
class="valeur">'.$adh->nom.'&nbsp;</td>';
+print '</tr>';
+
+// Prenom
+print '<tr><td width="15%">'.$langs->trans("Firstname").'</td><td 
class="valeur">'.$adh->prenom.'&nbsp;</td>';
+print '</tr>';
+
+// Login
+print '<tr><td>'.$langs->trans("Login").'</td><td 
class="valeur">'.$adh->login.'&nbsp;</td></tr>';
+
+// Password not crypted
+if ($conf->global->LDAP_FIELD_PASSWORD)
+{
+       print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
+       print '<td class="valeur">'.$fuser->pass.'</td>';
+       print "</tr>\n";
+}
+
+// Password crypted
+if ($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)
+{
+       print '<tr><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td>';
+       print '<td class="valeur">'.$fuser->pass_crypted.'</td>';
+       print "</tr>\n";
+}
+
+// Type
+print '<tr><td>'.$langs->trans("Type").'</td><td 
class="valeur">'.$adh->type."</td></tr>\n";
+
+$langs->load("admin");
+
+// LDAP DN
+print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td 
class="valeur">'.$conf->global->LDAP_MEMBER_DN."</td></tr>\n";
+
+// LDAP Clé
+print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td 
class="valeur">'.$conf->global->LDAP_KEY_MEMBERS."</td></tr>\n";
+
+// LDAP Server
+print '<tr><td>LDAP '.$langs->trans("Type").'</td><td 
class="valeur">'.$conf->global->LDAP_SERVER_TYPE."</td></tr>\n";
+print '<tr><td>LDAP '.$langs->trans("Version").'</td><td 
class="valeur">'.$conf->global->LDAP_SERVER_PROTOCOLVERSION."</td></tr>\n";
+print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td 
class="valeur">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
+print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td 
class="valeur">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
+print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td 
class="valeur">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
+
+print '</table>';
+
+print '</div>';
+
+print '<br>';
+
+
+print_titre($langs->trans("LDAPInformationsForThisMember"));
+
+// Affichage attributs LDAP
+print '<table width="100%" class="noborder">';
+
+print '<tr class="liste_titre">';
+print '<td>'.$langs->trans("LDAPAttributes").'</td>';
+print '<td>'.$langs->trans("Value").'</td>';
+print '</tr>';
+
+// Lecture LDAP
+$ldap=new Ldap();
+$result=$ldap->connect_bind();
+if ($result > 0)
+{
+       $info=$adh->_load_ldap_info();
+       $dn=$adh->_load_ldap_dn($info,1);
+       $search = "(".$adh->_load_ldap_dn($info,2).")";
+       $records=$ldap->search($dn,$search);
+
+       //print_r($records);
+
+       // Affichage arbre
+       if (sizeof($records) && (! isset($records['count']) || 
$records['count'] > 0))
+       {
+               if (! is_array($records))
+               {
+                       print '<tr '.$bc[false].'><td colspan="2"><font 
class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';     
+               }
+               else
+               {
+                       $result=show_ldap_content($records,0,0,true);
+               }
+       }
+       else
+       {
+               print '<tr '.$bc[false].'><td 
colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - 
search='.$search.')</td></tr>';
+       }
+
+       $ldap->unbind();
+       $ldap->close();
+}
+else
+{
+       dol_print_error('',$ldap->error);
+}
+
+
+print '</table>';
+
+
+
+
+$db->close();
+
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.17 $');
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/htdocs/lib/liste.php 
me/htdocs/lib/liste.php
--- dolibarr-snapshot/htdocs/lib/liste.php      1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/liste.php     2009-04-27 02:34:02.000000000 +0200
@@ -0,0 +1,316 @@
+<?php
+/* Copyright (C) 2001-2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2002-2003 Jean-Louis Bergamo   <address@hidden>
+ * Copyright (C) 2004-2009 Laurent Destailleur  <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ *      \file       htdocs/adherents/liste.php
+ *      \ingroup    adherent
+ *             \brief      Page to list all members of fundation
+ *             \version    $Id: liste.php,v 1.62 2009/02/20 22:53:24 eldy Exp $
+ */
+
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
+
+$langs->load("members");
+$langs->load("companies");
+
+$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
+
+$sortorder=$_GET["sortorder"];
+$sortfield=$_GET["sortfield"];
+$page=$_GET["page"];
+$filter=$_GET["filter"];
+$statut=isset($_GET["statut"])?$_GET["statut"]:'';
+
+if (! $sortorder) {  $sortorder="ASC"; }
+if (! $sortfield) {  $sortfield="d.nom"; }
+if ($page == -1) { $page = 0 ; }
+$offset = $conf->liste_limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+if ($_REQUEST["button_removefilter"])
+{
+    $_GET["search_nom"]="";
+    $_REQUEST["search_nom"]="";
+    $_GET["search_prenom"]="";
+    $_REQUEST["search_prenom"]="";
+    $_GET["type"]="";
+    $_REQUEST["type"]="";
+    $_GET["search_email"]="";
+    $_REQUEST["search_email"]="";
+    $sall="";
+}
+
+
+/*
+ * View
+ */
+
+llxHeader();
+
+$form=new Form($db);
+
+$membertypestatic=new AdherentType($db);
+
+$sql = "SELECT d.rowid, d.login, d.prenom, d.nom, d.societe, ";
+$sql.= " ".$db->pdate("d.datefin")." as datefin,";
+$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
+$sql.= " t.libelle as type, t.cotisation";
+$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type 
as t";
+$sql.= " WHERE d.fk_adherent_type = t.rowid ";
+if ($sall)
+{
+    $sql.=" AND (d.prenom like '%".$sall."%' OR d.nom like '%".$sall."%' OR 
d.societe like '%".$sall."%'";
+    $sql.=" OR d.email like '%".$sall."%' OR d.login like '%".$sall."%' OR 
d.adresse like '%".$sall."%'";
+    $sql.=" OR d.ville like '%".$sall."%' OR d.note like '%".$sall."%')";
+}
+if ($_REQUEST["type"] > 0)
+{
+    $sql.=" AND t.rowid=".$_REQUEST["type"];
+}
+if (isset($_GET["statut"]))
+{
+    $sql.=" AND d.statut in ($statut)";     // Peut valoir un nombre ou liste 
de nombre s�par�s par virgules
+}
+if ( $_POST["action"] == 'search')
+{
+  if (isset($_POST['search']) && $_POST['search'] != ''){
+    $sql.= " AND (d.prenom LIKE '%".$_POST['search']."%' OR d.nom LIKE 
'%".$_POST['search']."%')";
+  }
+}
+if ($_GET["search_nom"])
+{
+    $sql.= " AND (d.prenom LIKE '%".$_GET["search_nom"]."%' OR d.nom LIKE 
'%".$_GET["search_nom"]."%')";
+}
+if ($_GET["search_login"])
+{
+    $sql.= " AND d.login LIKE '%".$_GET["search_login"]."%'";
+}
+if ($_GET["search_email"])
+{
+    $sql.= " AND (d.email LIKE '%".$_GET["search_email"]."%')";
+}
+if ($filter == 'uptodate')
+{
+    $sql.=" AND datefin >= ".$db->idate(mktime());
+}
+if ($filter == 'outofdate')
+{
+    $sql.=" AND datefin < ".$db->idate(mktime());
+}
+// Count total nb of records
+$nbtotalofrecords = 0;
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+{
+    $result = $db->query($sql);
+    $nbtotalofrecords = $db->num_rows($result);
+}
+// Add order and limit
+$sql.= " ".$db->order($sortfield,$sortorder);
+$sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
+
+$resql = $db->query($sql);
+if ($resql)
+{
+    $num = $db->num_rows($resql);
+    $i = 0;
+
+    $titre=$langs->trans("MembersList");
+    if (isset($_GET["statut"]))
+    {
+        if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); 
}
+        if ($statut == '-1')   { $titre=$langs->trans("MembersListToValid"); }
+        if ($statut == '1' && ! $filter)               { 
$titre=$langs->trans("MembersListValid"); }
+        if ($statut == '1' && $filter=='uptodate')  { 
$titre=$langs->trans("MembersListUpToDate"); }
+        if ($statut == '1' && $filter=='outofdate')    { 
$titre=$langs->trans("MembersListNotUpToDate"); }
+        if ($statut == '0')    { 
$titre=$langs->trans("MembersListResiliated"); }
+    }
+    elseif ($_POST["action"] == 'search') {
+        $titre=$langs->trans("MembersListQualified");
+    }
+
+    if ($_REQUEST["type"] > 0)
+    {
+               $membertype=new AdherentType($db);
+        $result=$membertype->fetch($_REQUEST["type"]);
+               $titre.=" (".$membertype->libelle.")";
+    }
+
+    $param="";
+    if (isset($_GET["statut"]))       $param.="&statut=".$_GET["statut"];
+    if (isset($_GET["search_nom"]))   
$param.="&search_nom=".$_GET["search_nom"];
+    if (isset($_GET["search_login"])) 
$param.="&search_login=".$_GET["search_login"];
+    if (isset($_GET["search_email"])) 
$param.="&search_email=".$_GET["search_email"];
+    if (isset($_GET["filter"]))       $param.="&filter=".$_GET["filter"];
+    
print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
+
+    if ($sall)
+    {
+        print $langs->trans("Filter")." (".$langs->trans("Lastname").", 
".$langs->trans("Firstname").", ".$langs->trans("EMail").", 
".$langs->trans("Address")." ".$langs->trans("or")." 
".$langs->trans("Town")."): ".$sall;
+    }
+
+    print "<table class=\"noborder\" width=\"100%\">";
+
+    print '<tr class="liste_titre">';
+    print_liste_field_titre($langs->trans("Name")." / 
".$langs->trans("Company"),"liste.php","d.nom",$param,"","",$sortfield,$sortorder);
+    
print_liste_field_titre($langs->trans("Login"),"liste.php","d.login",$param,"","",$sortfield,$sortorder);
+    
print_liste_field_titre($langs->trans("Type"),"liste.php","t.libelle",$param,"","",$sortfield,$sortorder);
+    
print_liste_field_titre($langs->trans("Person"),"liste.php","d.morphy",$param,"","",$sortfield,$sortorder);
+    
print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email",$param,"","",$sortfield,$sortorder);
+    
print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
+    
print_liste_field_titre($langs->trans("EndSubscription"),"liste.php","d.datefin",$param,"","",$sortfield,$sortorder);
+    print '<td width="60" align="center">'.$langs->trans("Action")."</td>\n";
+    print "</tr>\n";
+
+       // Lignes des champs de filtre
+       print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
+       print '<tr class="liste_titre">';
+
+       print '<td align="left">';
+       print '<input class="flat" type="text" name="search_nom" 
value="'.$_REQUEST["search_nom"].'" size="12"></td>';
+
+       print '<td align="left">';
+       print '<input class="flat" type="text" name="search_login" 
value="'.$_REQUEST["search_login"].'" size="7"></td>';
+
+       print '<td class="liste_titre">';
+    $listetype=$membertypestatic->liste_array();
+    $form->select_array("type", $listetype, $_REQUEST["type"], 1, 0, 0, 0, '', 
0, 12);
+    print '</td>';
+
+       print '<td class="liste_titre">&nbsp;</td>';
+
+       print '<td align="left">';
+       print '<input class="flat" type="text" name="search_email" 
value="'.$_REQUEST["search_email"].'" size="12"></td>';
+
+       print '<td class="liste_titre">&nbsp;</td>';
+
+       print '<td align="right" colspan="2" class="liste_titre">';
+       print '<input type="image" class="liste_titre" 
src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" 
name="button_search" alt="'.$langs->trans("Search").'">';
+    print '&nbsp; <input type="image" value="button_removefilter" 
class="liste_titre" 
src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" 
name="button_removefilter" alt="'.$langs->trans("RemoveFilter").'">';
+       print '</td>';
+
+       print "</tr>\n";
+       print '</form>';
+
+    $var=True;
+    while ($i < $num && $i < $conf->liste_limit)
+    {
+        $objp = $db->fetch_object($resql);
+
+        $adh=new Adherent($db);
+
+        // Nom
+        $var=!$var;
+        print "<tr $bc[$var]>";
+        if ($objp->societe != '')
+        {
+            print "<td><a 
href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").'
 '.$objp->prenom." ".dol_trunc($objp->nom,12)." / 
".dol_trunc($objp->societe,12)."</a></td>\n";
+        }
+        else
+        {
+            print "<td><a 
href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").'
 '.$objp->prenom." ".dol_trunc($objp->nom)."</a></td>\n";
+        }
+
+        // Login
+        print "<td>".$objp->login."</td>\n";
+
+        // Type
+        print '<td nowrap="nowrap">';
+        $membertypestatic->id=$objp->type_id;
+        $membertypestatic->libelle=$objp->type;
+        print $membertypestatic->getNomUrl(1,12);
+        print '</td>';
+
+        // Moral/Physique
+        print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
+
+        // EMail
+        print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
+
+        // Statut
+        print "<td>";
+        print 
$adh->LibStatut($objp->statut,$objp->cotisation,$objp->datefin,2);
+        print "</td>";
+
+        // Date fin cotisation
+        if ($objp->datefin)
+        {
+               print '<td align="center">';
+            if ($objp->datefin < time() && $objp->statut > 0)
+            {
+                print dol_print_date($objp->datefin)." 
".img_warning($langs->trans("SubscriptionLate"));
+            }
+            else
+            {
+                print dol_print_date($objp->datefin);
+            }
+            print '</td>';
+        }
+        else
+        {
+               print '<td align="left">';
+               if ($objp->cotisation == 'yes')
+               {
+                print $langs->trans("SubscriptionNotReceived");
+                if ($objp->statut > 0) print " ".img_warning();
+               }
+               else
+               {
+                   print '&nbsp;';
+               }
+            print '</td>';
+        }
+
+        // Actions
+        print '<td align="center">';
+               if ($user->rights->adherent->creer)
+               {
+                       print "<a 
href=\"fiche.php?rowid=$objp->rowid&action=edit&return=liste.php\">".img_edit()."</a>";
+               }
+               print '&nbsp;';
+               if ($user->rights->adherent->supprimer)
+               {
+                       print "<a 
href=\"fiche.php?rowid=$objp->rowid&action=resign&return=liste.php\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
+        }
+               print "</td>";
+
+        print "</tr>\n";
+        $i++;
+    }
+
+    print "</table>\n";
+
+       if ($num > $conf->liste_limit)
+       {
+           
print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
+       }
+}
+else
+{
+    dol_print_error($db);
+}
+
+
+$db->close();
+
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.62 $');
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/lib/member.lib.php me/htdocs/lib/member.lib.php
--- dolibarr-snapshot/htdocs/lib/member.lib.php 2009-10-22 03:05:28.000000000 
+0200
+++ me/htdocs/lib/member.lib.php        2009-10-27 00:44:46.000000000 +0100
@@ -19,7 +19,7 @@
 
 /**
  *         \file       htdocs/lib/member.lib.php
- *             \brief      Ensemble de fonctions de base pour les adh�rents
+ *             \brief      Ensemble de fonctions de base pour les adherents
  *             \version    $Id: member.lib.php,v 1.12 2009/10/21 17:42:32 
hregis Exp $
  *
  *             Ensemble de fonctions de base de dolibarr sous forme d'include
@@ -36,6 +36,11 @@
        $head[$h][1] = $langs->trans("MemberCard");
        $head[$h][2] = 'general';
        $h++;
+ 
+       $head[$h][0] = DOL_URL_ROOT.'/adherents/plus.php?id='.$member->id;
+       $head[$h][1] = $langs->trans("MemberPlus");
+       $head[$h][2] = 'plus';
+       $h++;
 
        if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
        {
@@ -85,4 +90,4 @@
        return $head;
 }
 
-?>
\ Pas de fin de ligne à la fin du fichier.
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/htdocs/lib/note.php 
me/htdocs/lib/note.php
--- dolibarr-snapshot/htdocs/lib/note.php       1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/note.php      2009-04-27 02:34:02.000000000 +0200
@@ -0,0 +1,162 @@
+<?php
+/* Copyright (C) 2004      Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2004-2007 Laurent Destailleur  <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+        \file       htdocs/adherents/note.php
+        \ingroup    member
+        \brief      Fiche de notes sur un adherent
+               \version    $Id: note.php,v 1.14 2009/02/20 22:53:24 eldy Exp $
+*/
+
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT.'/lib/member.lib.php');
+require_once(DOL_DOCUMENT_ROOT.'/adherents/adherent.class.php');
+
+$action=isset($_GET["action"])?$_GET["action"]:(isset($_POST["action"])?$_POST["action"]:"");
+$id=isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:"");
+
+$langs->load("companies");
+$langs->load("members");
+$langs->load("bills");
+
+if (!$user->rights->adherent->lire)
+  accessforbidden();
+
+$adh = new Adherent($db);
+$adh->id = $id;
+$adh->fetch($id);
+
+
+/******************************************************************************/
+/*                     Actions                                                
*/
+/******************************************************************************/
+
+if ($_POST["action"] == 'update' && $user->rights->adherent->creer && ! 
$_POST["cancel"])
+{
+       $db->begin();
+       
+       $res=$adh->update_note($_POST["note"],$user);
+       if ($res < 0)
+       {
+               $mesg='<div class="error">'.$adh->error.'</div>';
+               $db->rollback();
+       }
+       else
+       {
+               $db->commit();
+       }
+}
+
+
+
+/******************************************************************************/
+/* Affichage fiche                                                            
*/
+/******************************************************************************/
+
+llxHeader();
+
+$html = new Form($db);
+
+if ($id)
+{
+       $head = member_prepare_head($adh);
+       
+       dol_fiche_head($head, 'note', $langs->trans("Member"));
+
+       if ($msg) print '<div class="error">'.$msg.'</div>';
+
+       print "<form method=\"post\" action=\"note.php\">";
+       
+    print '<table class="border" width="100%">';
+
+    // Reference
+       print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
+       print '<td colspan="3">';
+       print $html->showrefnav($adh,'id');
+       print '</td>';
+       print '</tr>';
+
+    // Nom
+    print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" 
colspan="3">'.$adh->nom.'&nbsp;</td>';
+       print '</tr>';
+
+    // Prenom
+    print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" 
colspan="3">'.$adh->prenom.'&nbsp;</td></tr>';
+
+    // Login
+    print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur" 
colspan="3">'.$adh->login.'&nbsp;</td></tr>';
+
+       // Note
+    print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
+       print '<td valign="top" colspan="3">';
+       if ($action == 'edit' && $user->rights->adherent->creer)
+       {
+               print "<input type=\"hidden\" name=\"action\" 
value=\"update\">";
+               print "<input type=\"hidden\" name=\"id\" 
value=\"".$adh->id."\">";
+               if ($conf->fckeditor->enabled && 
$conf->global->FCKEDITOR_ENABLE_MEMBER)
+           {
+                   // Editeur wysiwyg
+                       
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+                       $doleditor=new 
DolEditor('note',$adh->note,280,'dolibarr_notes','In',true);
+                       $doleditor->Create();
+           }
+           else
+           {
+                       print '<textarea name="note" cols="80" 
rows="10">'.dol_htmlentitiesbr_decode($adh->note).'</textarea>';
+           }
+       }
+       else
+       {
+               print nl2br($adh->note);
+       }
+       print "</td></tr>";
+
+       if ($action == 'edit')
+       {
+               print '<tr><td colspan="4" align="center">';
+               print '<input type="submit" class="button" name="update" 
value="'.$langs->trans("Save").'">';
+               print '&nbsp; &nbsp;';
+               print '<input type="submit" class="button" name="cancel" 
value="'.$langs->trans("Cancel").'">';
+               print '</td></tr>';
+       }
+
+    print "</table>";
+       print "</form>\n";
+
+       
+    /*
+    * Actions
+    */
+    print '</div>';
+    print '<div class="tabsAction">';
+
+    if ($user->rights->adherent->creer && $action != 'edit')
+    {
+        print "<a class=\"butAction\" 
href=\"note.php?id=$adh->id&amp;action=edit\">".$langs->trans('Modify')."</a>";
+    }
+
+    print "</div>";
+
+
+}
+
+$db->close();
+
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.14 $');
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/lib/options.php me/htdocs/lib/options.php
--- dolibarr-snapshot/htdocs/lib/options.php    1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/options.php   2009-10-18 23:47:10.000000000 +0200
@@ -0,0 +1,326 @@
+<?php
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2003      Jean-Louis Bergamo   <address@hidden>
+ * Copyright (C) 2004-2009 Laurent Destailleur  <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**     \file       htdocs/adherents/options.php
+ \ingroup    adherent
+ \brief      Page de configuratin des champs optionnels
+ \version    $Id: options.php,v 1.22 2009/01/26 23:58:37 eldy Exp $
+ */
+
+require("./pre.inc.php");
+require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
+
+$langs->load("members");
+
+$adho = new AdherentOptions($db);
+$form = new Form($db);
+
+/*
+ * Actions
+ */
+if ($_POST["action"] == 'add' && $user->rights->adherent->configurer)
+{
+       if ($_POST["button"] != $langs->trans("Cancel"))
+       {
+               // Type et taille non encore pris en compte => varchar(255)
+               if (isset($_POST["attrname"]) && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
+               {
+                       
$adho->create($_POST['attrname'],$_POST['type'],$_POST['size'],$_POST['table']);
+                       if (isset($_POST['label']))
+                       {
+                               
$adho->create_label($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$_POST['size'],$_POST['table']);
+                       }
+                       Header("Location: ".$_SERVER["PHP_SELF"]);
+                       exit;
+               } else {
+                       $langs->load("errors");
+                       
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
+                       $_GET["action"] = 'create';
+               }
+       }
+}
+
+if ($_POST["action"] == 'addtbl' && $user->rights->adherent->configurer)
+{
+       if ($_POST["button"] != $langs->trans("Cancel"))
+       {
+               // Type et taille non encore pris en compte => varchar(255)
+               if (isset($_POST['label']))
+               {
+                       if ($adho->create_attrtable($_POST['label'])) {
+                               Header("Location: ".$_SERVER["PHP_SELF"]);
+                       } else {
+                               $langs->load("errors");
+                               
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
+                               $_GET["action"] = 'createtbl';
+                       }
+               }
+       }
+}
+
+if ($_POST["action"] == 'update' && $user->rights->adherent->configurer)
+{
+       if ($_POST["button"] != $langs->trans("Cancel"))
+       {
+               if (isset($_POST["attrname"]) && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
+               {
+                       if (!isset($_POST['size'])||($_POST['size'] < 1)) 
$_POST['size'] = 1;
+                       
$adho->update($_POST['attrname'],$_POST['type'],$_POST['size']);
+                       if (isset($_POST['label']))
+                       {
+                               
$adho->update_label($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['size']);
+                       }
+                       Header("Location: ".$_SERVER["PHP_SELF"]);
+                       exit;
+               }
+               else
+               {
+                       $langs->load("errors");
+                       
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
+               }
+       }
+}
+
+# Suppression attribut
+if ($_GET["action"] == 'delete' && $user->rights->adherent->configurer)
+{
+       if(isset($_GET['attrname']) && 
preg_match("/^\w[a-zA-Z0-9-_]*$/",$_GET['attrname']))
+       {
+               $adho->delete($_GET['attrname']);
+               Header("Location: ".$_SERVER["PHP_SELF"]);
+               exit;
+       }
+       else
+       {
+               $langs->load("errors");
+               
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
+       }
+}
+
+# Suppression table attribut
+if ($_POST["action"] == 'deletetbl' && $user->rights->adherent->configurer)
+{
+       $adho->drop_table($_POST['tablenum']);
+}
+
+if ($_POST["action"] == 'updtbl' && $user->rights->adherent->configurer)
+{
+       $adho->update_table($_POST['tablenum'], $_POST['label']);
+}
+
+
+
+/*
+ * View
+ */
+
+llxHeader();
+
+
+
+if ($mesg) print '<div class="error">'.$mesg.'</div><br>';
+
+// Load attribute_definition
+$LesTables = fetch_optionals_table(1);
+while (list($tablenum, $tablelabel) = each($LesTables))
+{
+       print '<br>';
+       if ($tablenum == 0) {
+               print_titre($langs->trans("OptionalFieldsSetup"));
+       } else {
+               $lien = "<a 
href=\"options.php?action=edittbl&tablenum=$tablenum\">".img_edit()."</a>&nbsp;"
+                       ."<a 
href=\"options.php?action=confdeltbl&tablenum=$tablenum\">".img_delete()."</a>&nbsp;";
+               print_titre($lien.$langs->trans("OptionalFieldsTable", 
$LesTables[$tablenum]));
+       }
+       
+       $adho->fetch_name_optionals_def($tablenum);
+       print "<table class=\"noborder\" width=\"100%\">";
+       print '<tr class="liste_titre">';
+       print '<td width="40%">'.$langs->trans("Label").'</td>';
+       print '<td width="25%">'.$langs->trans("AttributeCode").'</td>';
+       print '<td width="25%">'.$langs->trans("Type").'</td><td 
width="10%">&nbsp;</td>';
+       print "</tr>\n";
+       $var=True;
+       while (list($key, $option) = each($adho->attribute_definition)) {
+               $var=!$var;
+               print "<tr $bc[$var]>";
+               print "<td>".$option['label']."&nbsp;</td>\n";
+               print "<td>$key</td>\n";
+               print '<td>'.$option['type'].'</td>'."\n";
+               print "<td align=\"right\"><a 
href=\"options.php?action=edit&attrname=$key\">".img_edit()."</a>";
+               print "&nbsp; <a 
href=\"options.php?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
+               print "</tr>";
+               //      $i++;
+       }
+       print "</table>";
+}
+
+/*
+ * Barre d'actions
+ *
+ */
+switch($_GET["action"])
+{
+       case 'create':
+       case 'createtbl':
+       case 'edit':
+       case 'editbl':
+       case 'confdeltbl':
+               break;
+       default:
+               print '<div class="tabsAction">';
+               print "<a class=\"butAction\" 
href=\"options.php?action=createtbl\">".$langs->trans("NewAttributeTable")."</a>";
+               print "<a class=\"butAction\" 
href=\"options.php?action=create\">".$langs->trans("NewAttribute")."</a>";
+               print "</div>";
+}
+
+
+/* ************************************************************************** 
*/
+/*                                                                            
*/
+/* Creation d'un champ optionnel
+ /*                                                                            
*/
+/* ************************************************************************** 
*/
+
+if ($_GET["action"] == 'create')
+{
+       print '<br><hr />';
+
+       print_titre($langs->trans('NewAttribute'));
+
+       print '<form action="options.php" method="post">';
+       print '<table class="border" width="100%">';
+
+       print '<input type="hidden" name="action" value="add">';
+
+       print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur"><input 
type="text" name="label" size="40"></td></tr>';
+       print '<tr><td>'.$langs->trans("AttributeCode").' 
('.$langs->trans("AlphaNumOnlyCharsAndNoSpace").')</td><td 
class="valeur"><input type="text" name="attrname" size="10"></td></tr>';
+       print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">';
+       $form->select_array('type',array('varchar'=>$langs->trans('String'),
+       'text'=>$langs->trans('Text'),
+       'int'=>$langs->trans('Int'),
+       'date'=>$langs->trans('Date'),
+       'datetime'=>$langs->trans('DateAndTime')));
+       print '</td></tr>';
+       print '<tr><td>Taille</td><td><input type="text" name="size" size="5" 
value="255"></td></tr>';
+       print '<tr><td>Tableau</td><td>';
+       $les_tables = fetch_optionals_table(1);
+       $form->select_array('table',$les_tables);
+       print '</td></tr>';
+       print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+       print "</form>\n";
+       print "</table>\n";
+}
+
+if ($_GET["action"] == 'createtbl')
+{
+       print '<br><hr />';
+
+       print_titre($langs->trans('NewAttributeTable'));
+
+       print '<form action="options.php" method="post">';
+       print '<table class="border" width="100%">';
+
+       print '<input type="hidden" name="action" value="addtbl">';
+
+       print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur"><input 
type="text" name="label" size="40"></td></tr>';
+
+       print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+       print "</form>\n";
+       print "</table>\n";
+}
+
+if ($_GET["action"] == 'edittbl')
+{
+       print '<br><hr />';
+
+       print_titre($langs->trans('UpdAttributeTable'));
+
+       print '<form action="options.php" method="post">';
+       print '<table class="border" width="100%">';
+       print '<input type="hidden" name="tablenum" 
value="'.$_GET['tablenum'].'">';
+       print '<input type="hidden" name="action" value="updtbl">';
+
+       print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur"><input 
type="text" name="label" size="40" 
value="'.$LesTables[$_GET['tablenum']].'"></td></tr>';
+
+       print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+       print "</form>\n";
+       print "</table>\n";
+}
+
+/* ************************************************************************** 
*/
+/*                                                                            
*/
+/* Edition d'un champ optionnel                                               
*/
+/*                                                                            
*/
+/* ************************************************************************** 
*/
+if ($_GET['attrname'] && $_GET["action"] == 'edit')
+{
+       print '<br><hr />';
+
+       print_titre($langs->trans("FieldEdition",$_GET['attrname']));
+
+       /*
+        * formulaire d'edition
+        */
+       print '<form method="post" 
action="options.php?attrname='.$_GET['attrname'].'">';
+       print '<input type="hidden" name="attrname" 
value="'.$_GET['attrname'].'">';
+       print '<input type="hidden" name="action" value="update">';
+       print '<table class="border" width="100%">';
+
+       print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur"><input 
type="text" name="label" size="40" 
value="'.$adho->attribute_definition[$_GET['attrname']]['label'].'"></td></tr>';
+       print '<tr><td>'.$langs->trans("AttributeName").'</td><td 
class="valeur">'.$_GET['attrname'].'&nbsp;</td></tr>';
+       
list($type,$size)=preg_split('/\(|\)/',$adho->attribute_name[$_GET['attrname']]);
+       print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">';
+       $form->select_array('type',array('varchar'=>$langs->trans('String'),
+       'text'=>$langs->trans('Text'),
+       'int'=>$langs->trans('Int'),
+       'date'=>$langs->trans('Date'),
+       
'datetime'=>$langs->trans('DateAndTime')),$adho->attribute_definition[$_GET['attrname']]['type']);
+       print '</td></tr>';
+
+       print '<tr><td>'.$langs->trans("Size").'</td><td class="valeur"><input 
type="text" name="size" size="5" 
value="'.$adho->attribute_definition[$_GET['attrname']]['size'].'"></td></tr>';
+       print '<tr><td colspan="2" align="center"><input type="submit" 
class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+       print '</table>';
+       print "</form>";
+
+}
+
+if ($_GET['tablenum'] && $_GET['action'] == 'confdeltbl')
+{
+       print '<br><hr />';
+
+       
print_titre($langs->trans('ConfirmDelAttrTbl'),$LesTables[$_GET['tablenum']]);
+
+       print '<form action="options.php" method="post">';
+       print '<table class="border" width="100%">';
+       print '<input type="hidden" name="tablenum" 
value="'.$_GET['tablenum'].'">';
+       print '<input type="hidden" name="action" value="deletetbl">';
+       print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+       print "</form>\n";
+       print "</table>\n";
+}
+$db->close();
+
+llxFooter('$Date: 2009/01/26 23:58:37 $ - $Revision: 1.22 $');
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/htdocs/lib/plus.php 
me/htdocs/lib/plus.php
--- dolibarr-snapshot/htdocs/lib/plus.php       1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/plus.php      2009-10-18 21:58:08.000000000 +0200
@@ -0,0 +1,250 @@
+<?php
+/* Copyright (C) 2009      Thibaut des ABBAYES <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+        \file       htdocs/adherents/plus.php
+        \ingroup    adherents
+        \brief      onglet d'informations en tableau sur un adherent
+               \version    $Id: plus.php,v 1.1 2009-09-12 06:39:20 tibo Exp $
+*/
+$err='gérer l ordre de tri maintenant que les liens sont OK';
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT.'/lib/member.lib.php');
+require(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
+require_once(DOL_DOCUMENT_ROOT.'/adherents/adherent_option_table.class.php');
+
+$action=isset($_GET["action"])?$_GET["action"]:(isset($_POST["action"])?$_POST["action"]:'');
+$do_it=isset($_GET["do_it"])?$_GET["do_it"]:(isset($_POST["do_it"])?$_POST["do_it"]:'');
+$id=isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:'');
+$sortorder=isset($_GET['sortorder'])?$_GET['sortorder']:$_POST['sortorder'];
+$tablenum=isset($_GET['tablenum'])?$_GET['tablenum']:$_POST['tablenum'];
+$linenum=isset($_GET['linenum'])?$_GET['linenum']:$_POST['linenum'];
+
+$langs->load("companies");
+$langs->load("members");
+$langs->load("bills");
+
+if (!$user->rights->adherent->lire)
+  accessforbidden();
+
+
+/******************************************************************************/
+/*                     Actions                                                
*/
+/******************************************************************************/
+
+if ($user->rights->adherent->creer && ($_POST['do_it'] == 1) && ! 
$_POST["cancel"])
+{
+       $db->begin();
+
+    $adho = new AdherentOptionTable($_POST['tablenum']);
+
+    switch ($action)
+    {
+        case 'create':
+            // Execute le SQL d'insertion
+            $resu = $adho->insert_plus();
+            break;
+        case 'edit':
+            // Execute le SQL de mise à jour
+            $resu = $adho->update_plus();
+            break;
+        case 'delete':
+            // Execute le SQL d'effacement
+            $resu = $adho->delete_plus();
+            break;
+        default:
+            die('XXX '.$action);
+    }
+    $action = 'select';
+    
+    // Gère les erreurs d'exécution
+    if ($res < 0)
+       {
+               $mesg='<div class="error">'.$res.'</div>';
+               $db->rollback();
+       }
+       else
+       {
+               $db->commit();
+        $action='select';
+        $do_it=0;
+       }
+}
+
+
+
+/******************************************************************************/
+/* Affichage fiche                                                            
*/
+/******************************************************************************/
+
+$adh = new Adherent($db);
+$adh->id = $id;
+$adh->fetch($id);
+
+llxHeader();
+
+$html = new Form($db);
+
+if ($id)
+{
+       $head = member_prepare_head($adh);
+       dol_fiche_head($head, 'plus', $langs->trans("MemberPlus"));
+       if ($msg) print '<div class="error">'.$msg.'</div>';
+
+    print "<form method=\"post\" action=\"plus.php\">";
+    switch($action)
+    {
+        case '':
+        case 'select':
+            // Affiche le select
+            affiche_le_select($id);
+            break;
+        case 'edit':
+            // Affiche le update
+            affiche_le_update($id, $tablenum, $linenum);
+            break;
+        case 'create':
+            // Affiche le insert
+            affiche_le_create($id, $tablenum);
+            break;
+        case 'delete':
+            // Affiche le confirm du delete
+            affiche_le_delete($id, $tablenum, $linenum);
+            break;
+
+    }
+    print "</form>";
+}
+
+$db->close();
+
+llxFooter('$Date: 2009-09-12 06:39:20 $ - $Revision: 1.1 $');
+
+
+
+function affiche_le_select($id)
+{
+    global $db, $langs, $user, $sortorder;
+    // Liste des tableaux
+       $tbls = fetch_optionals_table();
+       while (list($tableau_id, $label) = each($tbls))
+       {
+               $tablo = new AdherentOptionTable($tableau_id);
+               $tablo->GetData($id, $sortorder);
+               // Affiche le titre
+               print '<div class="titre">'.$tablo->titre.'</div>';
+               // Affiche l'entête
+               print '<table class="noborder" width="100%">';
+               print '<tr class="liste_titre">';
+               reset($tablo->arr_fields);
+               while (list($k,$f) = each($tablo->arr_fields))
+               {
+                       
print_liste_adh_plus_titre($f['label'],'plus.php?id='.$id, $tableau_id,$k+1, 
$sortorder);
+               }
+               print '<td width="60" 
align="center">'.$langs->trans("Action")."</td>\n";
+               print "</tr>\n";
+
+               // Affiche les données
+               reset($tablo->arr_data);
+               $parite=0;
+               while (list($k,$l) = each($tablo->arr_data))
+               {
+                       print ($parite++ % 2) ? '<tr class="pair">':'<tr 
class="impair">';
+                       while (list($j,$v) = each($l))
+                               print '<td>'.$v.'</td>';
+                       // Colonne action
+                       // Actions
+                       print '<td align="center">';
+                       if ($user->rights->adherent->creer)
+                       {
+                               print "<a 
href=\"plus.php?action=edit&sortorder=$sortorder&id=$id&tablenum=$tableau_id&linenum=".$k."\">".img_edit()."</a>";
+                       }
+                       print '&nbsp;';
+                       if ($user->rights->adherent->supprimer)
+                       {
+                               print "<a 
href=\"plus.php?action=delete&sortorder=$sortorder&id=$id&tablenum=$tableau_id&linenum=".$k."\">".img_picto($langs->trans("Delete"),'delete.png')."</a>";
+                       }
+                       print "</td>";
+                       print '</tr>';
+               }
+               if ($user->rights->adherent->creer)
+               {
+                       print '</table>';
+                       print '<div class="tabsAction">';
+                       print "<a class=\"butAction\" 
href=\"plus.php?action=create&sortorder=$sortorder&id=$id&tablenum=$tableau_id\">".$langs->trans("New")."</a>";
+                       print "</div>";
+               }
+       }
+}
+
+
+
+function affiche_le_create($id, $tablenum)
+{
+    affiche_le_update($id, $tablenum);
+}
+
+function affiche_le_update($id, $tablenum, $linenum = 0)
+{
+    global $langs, $user, $sortorder, $action;
+
+    $tablo = new AdherentOptionTable($tablenum);
+    if ($linenum != 0)
+    {
+        $tablo->GetData($id, $sortorder);
+        $libmode = 'Modifier';
+    } else {
+        $libmode = 'Ajouter';
+    }
+    reset($tablo->arr_fields);
+    print '<div class="titre">'.$libmode.'&nbsp;'.$tablo->titre.'</div>';
+       print '<center>';
+    print '<input type="hidden" name="do_it" value="1">';
+    print '<input type="hidden" name="action" value="'.$action.'">';
+    print '<input type="hidden" name="id" value="'.$id.'">';
+    print '<input type="hidden" name="tablenum" value="'.$tablenum.'">';
+    print '<input type="hidden" name="linenum" value="'.$linenum.'">';
+    print '<table width="80%" class="border">';
+    while (list($k,$champ) = each($tablo->arr_fields))
+        print adhplus_input($champ, 
$tablo->arr_data[$linenum][$champ['name']]);
+    print '</table>';
+    print '<br /><input type="submit" class="button" 
value="'.$libmode.'&nbsp;'.$tablo->titre.'"></center>';
+}
+
+function affiche_le_delete($id, $tablenum, $linenum = 0)
+{
+    global $langs, $user, $sortorder, $action;
+
+    $tablo = new AdherentOptionTable($tablenum);
+    $tablo->GetData($id, $sortorder);
+    $libmode = 'Supprimer';
+    reset($tablo->arr_fields);
+    print '<div class="titre">'.$libmode.'&nbsp;'.$tablo->titre.'</div>';
+       print '<center>';
+    print '<input type="hidden" name="do_it" value="1">';
+    print '<input type="hidden" name="action" value="'.$action.'">';
+    print '<input type="hidden" name="id" value="'.$id.'">';
+    print '<input type="hidden" name="tablenum" value="'.$tablenum.'">';
+    print '<input type="hidden" name="linenum" value="'.$linenum.'">';
+    print '<table class="border">';
+    while (list($k,$champ) = each($tablo->arr_fields))
+        print 
'<tr><td>'.$champ['label'].'</td><td>'.$tablo->arr_data[$linenum][$champ['name']].'</td></tr>';
+    print '</table>';
+    print '<br /><input type="submit" class="button" value="Confirmer la 
suppression"></center>';
+}
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject 
dolibarr-snapshot/htdocs/lib/pre.inc.php me/htdocs/lib/pre.inc.php
--- dolibarr-snapshot/htdocs/lib/pre.inc.php    1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/pre.inc.php   2009-04-27 02:34:02.000000000 +0200
@@ -0,0 +1,70 @@
+<?php
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2004-2005 Laurent Destailleur  <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**     \file       htdocs/adherents/pre.inc.php
+        \ingroup    adherent
+               \brief      Fichier de gestion du menu gauche du module adherent
+               \version    $Id: pre.inc.php,v 1.29 2009/03/09 11:28:13 eldy 
Exp $
+*/
+
+require("../main.inc.php");
+
+function llxHeader($head = '', $title='', $help_url='')
+{
+       global $user, $conf, $langs;
+
+       $langs->load("members");
+
+       top_menu($head);
+
+       $menu = new Menu();
+
+
+       
$menu->add(DOL_URL_ROOT."/adherents/index.php",$langs->trans("Members"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/fiche.php?action=create",$langs->trans("NewMember"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php",$langs->trans("List"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=-1",$langs->trans("MenuMembersToValidate"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=1",$langs->trans("MenuMembersValidated"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/liste.php?statut=1&amp;filter=outofdate",$langs->trans("MenuMembersNotUpToDate"));
+       
$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(DOL_URL_ROOT."/adherents/public.php?leftmenu=member_public",$langs->trans("MemberPublicLinks"));
+
+       
$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."/adherents/htpasswd.php",$langs->trans("Filehtpasswd"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/cartes/carte.php",$langs->trans("MembersCards"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/cartes/etiquette.php",$langs->trans("MembersTickets"));
+
+       $langs->load("compta");
+       
$menu->add(DOL_URL_ROOT."/adherents/index.php",$langs->trans("Accountancy"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/cotisations.php",$langs->trans("Subscriptions"));
+       $langs->load("banks");
+       $menu->add_submenu(DOL_URL_ROOT."/compta/bank/",$langs->trans("Banks"));
+
+       $menu->add(DOL_URL_ROOT."/adherents/index.php",$langs->trans("Setup"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/type.php",$langs->trans("MembersTypes"));
+       
$menu->add_submenu(DOL_URL_ROOT."/adherents/options.php",$langs->trans("MembersAttributes"));
+
+       left_menu($menu->liste, $help_url);
+
+}
+
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/htdocs/lib/public.php 
me/htdocs/lib/public.php
--- dolibarr-snapshot/htdocs/lib/public.php     1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/public.php    2009-04-27 02:34:02.000000000 +0200
@@ -0,0 +1,66 @@
+<?php
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2006-2008 Laurent Destailleur  <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+               \file       htdocs/adherents/public.php
+               \ingroup    member
+               \brief      Fichier de la page de l'espace publique adherent
+               \author     Laurent Destailleur
+               \version    $Id: public.php,v 1.6 2009/02/11 20:44:02 eldy Exp $
+*/
+
+require("./pre.inc.php");
+
+
+
+/*
+ * View
+ */
+
+llxHeader();
+
+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 '<tr 
class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
+print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td><a 
target="_blank" 
href="'.DOL_URL_ROOT.'/public/members/new.php'.'">'.$dolibarr_main_url_root.DOL_URL_ROOT.'/public/members/new.php'.'</a></td></tr>';
+print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td><a 
target="_blank" 
href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.$dolibarr_main_url_root.DOL_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
+// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
+$firstpart=$dolibarr_main_url_root;
+$regex=DOL_URL_ROOT.'$';
+$firstpart=eregi_replace($regex,'',$firstpart);
+print 
'<tr><td>'.$langs->trans("PublicMemberCard").'</td><td>'.$firstpart.DOL_URL_ROOT.'/public/members/public_card.php?id=xxx'.'</td></tr>';
+print '</table>';
+
+
+print '</td></tr></table>';
+
+
+$db->close();
+
+llxFooter('$Date: 2009/02/11 20:44:02 $ - $Revision: 1.6 $');
+?>
diff -Naur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' 
--exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php 
--exclude=documents --exclude=nbproject dolibarr-snapshot/htdocs/lib/type.php 
me/htdocs/lib/type.php
--- dolibarr-snapshot/htdocs/lib/type.php       1970-01-01 01:00:00.000000000 
+0100
+++ me/htdocs/lib/type.php      2009-04-27 02:34:02.000000000 +0200
@@ -0,0 +1,380 @@
+<?php
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2003      Jean-Louis Bergamo   <address@hidden>
+ * Copyright (C) 2004-2008 Laurent Destailleur  <address@hidden>
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+        \file       htdocs/adherents/type.php
+        \ingroup    adherent
+               \brief      Page de configuration des types d'adhérents
+               \version    $Id: type.php,v 1.47 2009/02/20 22:53:24 eldy Exp $
+*/
+
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
+require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
+
+$langs->load("members");
+
+$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
+
+
+/*
+*      Actions
+*/
+if ($user->rights->adherent->configurer && $_POST["action"] == 'add') 
+{
+    if ($_POST["button"] != $langs->trans("Cancel"))
+    {
+        $adht = new AdherentType($db);
+          
+        $adht->libelle     = trim($_POST["libelle"]);
+        $adht->cotisation  = trim($_POST["cotisation"]);
+        $adht->note        = trim($_POST["comment"]);
+        $adht->mail_valid  = trim($_POST["mail_valid"]);
+        $adht->vote        = trim($_POST["vote"]);
+
+        if ($adht->libelle)
+        {
+            $id=$adht->create($user->id);
+            if ($id > 0)
+            {
+                Header("Location: type.php");
+                exit;
+            }
+                       else
+                       {
+                               $mesg=$adht->error;
+                               $_GET["action"] = 'create';
+                       }
+        }
+        else
+        {
+               
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
+                       $_GET["action"] = 'create';
+        }
+    }
+}
+
+if ($user->rights->adherent->configurer && $_POST["action"] == 'update') 
+{
+    if ($_POST["button"] != $langs->trans("Cancel"))
+    {
+        $adht = new AdherentType($db);
+        $adht->id          = $_POST["rowid"];
+        $adht->libelle     = trim($_POST["libelle"]);
+        $adht->cotisation  = trim($_POST["cotisation"]);
+        $adht->note        = trim($_POST["comment"]);
+        $adht->mail_valid  = trim($_POST["mail_valid"]);
+        $adht->vote        = trim($_POST["vote"]);
+        
+        $adht->update($user->id);
+
+        Header("Location: type.php?rowid=".$_POST["rowid"]);
+        exit;
+    }    
+}
+
+if ($user->rights->adherent->configurer && $_GET["action"] == 'delete')
+{
+       $adht = new AdherentType($db);
+       $adht->delete($rowid);
+       Header("Location: ".$_SERVER["PHP_SELF"]);
+       exit;
+}
+
+if ($user->rights->adherent->configurer && $_GET["action"] == 'commentaire')
+{
+       $don = new Don($db);
+       $don->fetch($rowid);
+       $don->update_note($_POST["commentaire"]);
+}
+
+
+
+llxHeader();
+
+$form=new Form($db);
+
+/* ************************************************************************** 
*/
+/*                                                                            
*/
+/* Liste des types d'adhérents                                                
*/
+/*                                                                            
*/
+/* ************************************************************************** 
*/
+
+if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit')
+{
+
+    print_titre($langs->trans("MembersTypeSetup"));
+    print '<br>';
+
+
+    $sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
+    $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
+    
+    $result = $db->query($sql);
+    if ($result) 
+    {
+      $num = $db->num_rows($result);
+      $i = 0;
+      
+      print '<table class="noborder" width="100%">';
+      
+      print '<tr class="liste_titre">';
+      print '<td>'.$langs->trans("Ref").'</td>';
+      print '<td>'.$langs->trans("Label").'</td>';
+         print '<td 
align="center">'.$langs->trans("SubscriptionRequired").'</td>';
+      print '<td align="center">'.$langs->trans("VoteAllowed").'</td>';
+         print '<td>&nbsp;</td>';
+      print "</tr>\n";
+      
+      $var=True;
+      while ($i < $num)
+        {
+          $objp = $db->fetch_object($result);
+          $var=!$var;
+          print "<tr $bc[$var]>";
+          print '<td><a 
href="type.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').'
 '.$objp->rowid.'</a></td>';
+          print '<td>'.$objp->libelle.'</td>';
+          print '<td align="center">'.yn($objp->cotisation).'</td>';
+          print '<td align="center">'.yn($objp->vote).'</td>';
+          print '<td><a 
href="type.php?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
+          print "</tr>";
+          $i++;
+        }
+      print "</table>";
+    }
+    else
+    {
+      dol_print_error($db);
+    }
+
+
+    /*
+     * Barre d'actions
+     *
+     */
+    print '<div class="tabsAction">';
+
+       // New type
+       if ($user->rights->adherent->configurer)
+       {
+               print "<a class=\"butAction\" 
href=\"type.php?action=create\">".$langs->trans("NewType")."</a>";
+       }
+
+    print "</div>";
+
+}
+
+
+/* ************************************************************************** 
*/
+/*                                                                            
*/
+/* Création d'un type adherent                                                
*/
+/*                                                                            
*/
+/* ************************************************************************** 
*/
+if ($_GET["action"] == 'create')
+{
+       $htmls = new Form($db);
+
+       print_titre($langs->trans("NewMemberType"));
+       print '<br>';
+
+       if ($mesg) print '<div class="error">'.$mesg.'</div>';
+
+       print "<form action=\"type.php\" method=\"post\">";
+       print '<table class="border" width="100%">';
+
+       print '<input type="hidden" name="action" value="add">';
+
+       print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" 
name="libelle" size="40"></td></tr>';  
+
+       print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
+       print $htmls->selectyesno("cotisation",1,1);
+       print '</td></tr>';
+
+       print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
+       print $htmls->selectyesno("vote",0,1);
+       print '</td></tr>';
+
+       print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
+       print "<textarea name=\"comment\" wrap=\"soft\" cols=\"60\" 
rows=\"3\"></textarea></td></tr>";
+
+       print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
+       if ($conf->fckeditor->enabled)
+       {
+               require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+               $doleditor=new 
DolEditor('mail_valid',$adht->mail_valid,280,'dolibarr_notes','',false);
+               $doleditor->Create();
+       }
+       else
+       {
+               print '<textarea class="flat" name="mail_valid" rows="15" 
cols="90">';
+               print dol_htmlentitiesbr_decode($adht->mail_valid);
+               print '</textarea>';
+       }
+       print '</td></tr>';
+
+       print '<tr><td colspan="2" align="center"><input type="submit" 
name="button" class="button" value="'.$langs->trans("Add").'"> &nbsp;';
+       print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+
+       print "</form>\n";
+       print "</table>\n";
+} 
+/* ************************************************************************** 
*/
+/*                                                                            
*/
+/* Edition de la fiche                                                        
*/
+/*                                                                            
*/
+/* ************************************************************************** 
*/
+if ($rowid > 0)
+{
+    if ($_GET["action"] != 'edit')
+    {
+        $adht = new AdherentType($db);
+        $adht->id = $rowid;
+        $adht->fetch($rowid);
+
+
+        $h=0;
+        
+        $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
+        $head[$h][1] = $langs->trans("Card");
+        $head[$h][2] = 'card';
+        $h++;
+
+        dol_fiche_head($head, 'card', $langs->trans("MemberType"));
+
+
+        print '<table class="border" width="100%">';
+        
+        // Ref
+               print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
+               print '<td>';
+               print $form->showrefnav($adht,'rowid');
+               print '</td></tr>';  
+               
+        // Label
+               print '<tr><td 
width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';  
+        
+        print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
+        print yn($adht->cotisation);
+        print '</tr>';
+        
+        print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
+        print yn($adht->vote);
+        print '</tr>';
+        
+        print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
+        print nl2br($adht->note)."</td></tr>";
+        
+        print '<tr><td 
valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
+        print nl2br($adht->mail_valid)."</td></tr>";
+        
+        print '</table>';
+
+        print '</div>';
+
+        /*
+         * Barre d'actions
+         *
+         */
+        print '<div class="tabsAction">';
+
+               // Edit
+               if ($user->rights->adherent->configurer)
+               {
+                       print "<a class=\"butAction\" 
href=\"type.php?action=edit&amp;rowid=".$adht->id."\">".$langs->trans("Modify")."</a>";
+               }
+       
+               // Add
+           print "<a class=\"butAction\" 
href=\"fiche.php?action=create&typeid=".$adht->id."\">".$langs->trans("AddMember")."</a>";
+
+               // Delete
+               if ($user->rights->adherent->configurer)
+               {
+                       print "<a class=\"butActionDelete\" 
href=\"type.php?action=delete&rowid=".$adht->id."\">".$langs->trans("DeleteType")."</a>";
+               }
+               
+        print "</div>";
+    }
+    
+    if ($_GET["action"] == 'edit')
+    {
+        $htmls = new Form($db);
+        
+        $adht = new AdherentType($db);
+        $adht->id = $rowid;
+        $adht->fetch($rowid);
+
+
+        $h=0;
+        
+        $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
+        $head[$h][1] = $langs->trans("Card");
+        $head[$h][2] = 'card';
+        $h++;
+
+        dol_fiche_head($head, 'card', $langs->trans("MemberType"));
+
+
+        print '<form method="post" 
action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">';
+        print '<input type="hidden" name="rowid" value="'.$rowid.'">';
+        print '<input type="hidden" name="action" value="update">';
+        print '<table class="border" width="100%">';
+        
+        print '<tr><td 
width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';  
+
+        print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" 
name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';  
+        
+        print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
+        print $htmls->selectyesno("cotisation",$adht->cotisation,1);
+        print '</td></tr>';
+        
+        print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
+        print $htmls->selectyesno("vote",$adht->vote,1);
+        print '</td></tr>';
+        
+        print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
+        print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" 
rows=\"3\">".$adht->note."</textarea></td></tr>";
+        
+        print '<tr><td 
valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
+               if ($conf->fckeditor->enabled)
+               {
+                       
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
+                       $doleditor=new 
DolEditor('mail_valid',$adht->mail_valid,280,'dolibarr_notes','',false);
+                       $doleditor->Create();
+               }
+               else
+               {
+                       print '<textarea class="flat" name="mail_valid" 
rows="15" cols="90">';
+                       print dol_htmlentitiesbr_decode($adht->mail_valid);
+                       print '</textarea>';
+               }
+        print "</td></tr>";
+        
+        print '<tr><td colspan="2" align="center"><input type="submit" 
class="button" value="'.$langs->trans("Save").'"> &nbsp; &nbsp;';
+        print '<input type="submit" name="button" class="button" 
value="'.$langs->trans("Cancel").'"></td></tr>';
+        
+        print '</table>';
+        print "</form>";
+    }
+}
+
+$db->close();
+
+llxFooter('$Date: 2009/02/20 22:53:24 $ - $Revision: 1.47 $');
+?>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]