2004-10-20 00:24:10 +02:00
< ? php
2005-02-11 16:34:56 +01:00
/* Copyright ( C ) 2003 , 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2005-03-06 01:15:34 +01:00
* Copyright ( C ) 2003 Jean - Louis Bergamo < jlb @ j1b . org >
2010-03-20 21:24:32 +01:00
* Copyright ( C ) 2004 - 2010 Laurent Destailleur < eldy @ users . sourceforge . net >
2005-03-06 01:15:34 +01:00
* Copyright ( C ) 2004 Sebastien Di Cintio < sdicintio @ ressource - toi . org >
* Copyright ( C ) 2004 Benoit Mortier < benoit . mortier @ opensides . be >
2003-09-15 16:03:49 +02:00
*
* 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 .
*/
2005-03-06 01:15:34 +01:00
/**
2009-07-30 00:52:08 +02:00
* \defgroup adherent Module foundation
2010-03-20 21:24:32 +01:00
* \brief Module to manage members of a foundation
2009-04-10 02:29:23 +02:00
*/
2004-08-14 14:21:24 +02:00
2005-01-14 19:46:23 +01:00
/**
2009-07-27 02:08:49 +02:00
* \file htdocs / includes / modules / modAdherent . class . php
2009-10-10 18:00:35 +02:00
* \ingroup member
* \brief File descriptor or module Member
2009-04-10 02:29:23 +02:00
* \version $Id $
*/
2004-08-14 14:21:24 +02:00
2007-10-10 01:15:25 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /includes/modules/DolibarrModules.class.php " );
2003-09-15 16:03:49 +02:00
2005-09-04 20:58:06 +02:00
/**
2009-07-27 02:08:49 +02:00
* \class modAdherent
* \brief Classe de description et activation du module Adherent
*/
2003-11-15 18:42:11 +01:00
class modAdherent extends DolibarrModules
2003-09-15 16:03:49 +02:00
{
2005-09-04 20:58:06 +02:00
/**
* \brief Constructeur . Definit les noms , constantes et boites
2010-03-20 21:24:32 +01:00
* \param DB Database handler
2005-09-04 20:58:06 +02:00
*/
function modAdherent ( $DB )
{
2007-05-21 03:49:37 +02:00
$this -> db = $DB ;
2005-09-04 20:58:06 +02:00
$this -> numero = 310 ;
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
$this -> family = " hr " ;
2008-10-01 21:10:17 +02:00
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
2009-10-21 15:09:42 +02:00
$this -> name = preg_replace ( '/^mod/i' , '' , get_class ( $this ));
2010-05-01 12:32:15 +02:00
$this -> description = " Gestion des adhérents d'une association " ;
2005-09-04 20:58:06 +02:00
$this -> version = 'dolibarr' ; // 'experimental' or 'dolibarr' or version
2008-10-06 09:39:52 +02:00
$this -> const_name = 'MAIN_MODULE_' . strtoupper ( $this -> name );
2007-12-28 15:53:52 +01:00
$this -> special = 0 ;
2005-09-04 20:58:06 +02:00
$this -> picto = 'user' ;
2009-02-11 21:44:00 +01:00
2009-04-28 15:52:08 +02:00
// Data directories to create when module is enabled
2010-05-01 12:32:15 +02:00
$this -> dirs = array ( " /adherents/temp " );
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
// Config pages
//-------------
2010-05-01 12:32:15 +02:00
$this -> config_page_url = array ( " adherent.php@adherents " );
2009-02-11 21:44:00 +01:00
2007-12-26 11:09:30 +01:00
// Dependances
2005-09-04 20:58:06 +02:00
//------------
$this -> depends = array ();
$this -> requiredby = array ();
2010-05-02 19:05:07 +02:00
$this -> langfiles = array ( " members " , " companies " );
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
// Constantes
//-----------
$this -> const = array ();
2007-12-26 11:09:30 +01:00
$this -> const [ 0 ] = array ( " ADHERENT_MAIL_RESIL " , " texte " , " Votre adhesion vient d'etre resiliee. \r \n Nous esperons vous revoir tres bientot " , " Mail de resiliation " );
2009-02-11 21:44:00 +01:00
$this -> const [ 1 ] = array ( " ADHERENT_MAIL_VALID " , " texte " , " Votre adhesion vient d'etre validee. \r \n Voici le rappel de vos coordonnees (toute information erronee entrainera la non validation de votre inscription) : \r \n \r \n %INFOS% \r \n \r \n " , " Mail de validation " );
2007-12-26 11:09:30 +01:00
$this -> const [ 5 ] = array ( " ADHERENT_MAIL_VALID_SUBJECT " , " chaine " , " Votre adhesion a ete validee " , " Sujet du mail de validation " );
$this -> const [ 6 ] = array ( " ADHERENT_MAIL_RESIL_SUBJECT " , " chaine " , " Resiliation de votre adhesion " , " Sujet du mail de resiliation " );
2007-02-10 15:47:32 +01:00
$this -> const [ 10 ] = array ( " ADHERENT_MAILMAN_UNSUB_URL " , " chaine " , " http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL% " , " Url de desinscription aux listes mailman " );
$this -> const [ 11 ] = array ( " ADHERENT_MAILMAN_URL " , " chaine " , " http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL% " , " Url pour les inscriptions mailman " );
2007-12-26 11:09:30 +01:00
$this -> const [ 12 ] = array ( " ADHERENT_MAILMAN_LISTS " , " chaine " , " " , " Listes auxquelles les nouveaux adherents sont inscris " );
2005-09-04 20:58:06 +02:00
$this -> const [ 16 ] = array ( " ADHERENT_USE_SPIP_AUTO " , " yesno " , " " , " Utilisation de SPIP automatiquement " );
2007-09-09 12:40:17 +02:00
$this -> const [ 17 ] = array ( " ADHERENT_SPIP_USER " , " chaine " , " " , " Utilisateur de connexion a la base spip " );
$this -> const [ 18 ] = array ( " ADHERENT_SPIP_PASS " , " chaine " , " " , " Mot de passe de connexion a la base spip " );
2005-09-04 20:58:06 +02:00
$this -> const [ 19 ] = array ( " ADHERENT_SPIP_SERVEUR " , " chaine " , " " , " serveur spip " );
$this -> const [ 20 ] = array ( " ADHERENT_SPIP_DB " , " chaine " , " " , " db spip " );
$this -> const [ 21 ] = array ( " ADHERENT_MAIL_FROM " , " chaine " , " " , " From des mails " );
2007-02-04 02:15:51 +01:00
$this -> const [ 22 ] = array ( " ADHERENT_MAIL_COTIS " , " texte " , " Bonjour %PRENOM%, \r \n Cet email confirme que votre cotisation a ete recue \r \n et enregistree " , " Mail de validation de cotisation " );
2007-02-10 15:47:32 +01:00
$this -> const [ 23 ] = array ( " ADHERENT_MAIL_COTIS_SUBJECT " , " chaine " , " Recu de votre cotisation " , " Sujet du mail de validation de cotisation " );
2005-09-04 20:58:06 +02:00
$this -> const [ 25 ] = array ( " ADHERENT_CARD_HEADER_TEXT " , " chaine " , " %ANNEE% " , " Texte imprime sur le haut de la carte adherent " );
2007-02-10 15:47:32 +01:00
$this -> const [ 26 ] = array ( " ADHERENT_CARD_FOOTER_TEXT " , " chaine " , " Association AZERTY " , " Texte imprime sur le bas de la carte adherent " );
2007-12-26 11:09:30 +01:00
$this -> const [ 27 ] = array ( " ADHERENT_CARD_TEXT " , " texte " , " %PRENOM% %NOM% \r \n Membre ne %ID% \r \n %EMAIL% \r \n %ADRESSE% \r \n %CP% %VILLE% \r \n %PAYS% " , " Texte imprime sur la carte adherent " );
2005-09-04 20:58:06 +02:00
$this -> const [ 28 ] = array ( " ADHERENT_MAILMAN_ADMINPW " , " chaine " , " " , " Mot de passe Admin des liste mailman " );
2009-11-26 23:40:28 +01:00
$this -> const [ 29 ] = array ( " ADHERENT_MAILMAN_SERVER " , " chaine " , " " , " Serveur hebergeant les interfaces d'Admin des listes mailman " );
2005-09-04 20:58:06 +02:00
$this -> const [ 30 ] = array ( " ADHERENT_MAILMAN_LISTS_COTISANT " , " chaine " , " " , " Liste(s) auxquelles les nouveaux cotisants sont inscris automatiquement " );
$this -> const [ 31 ] = array ( " ADHERENT_BANK_USE_AUTO " , " yesno " , " " , " Insertion automatique des cotisation dans le compte banquaire " );
$this -> const [ 32 ] = array ( " ADHERENT_BANK_ACCOUNT " , " chaine " , " " , " ID du Compte banquaire utilise " );
$this -> const [ 33 ] = array ( " ADHERENT_BANK_CATEGORIE " , " chaine " , " " , " ID de la categorie banquaire des cotisations " );
$this -> const [ 34 ] = array ( " ADHERENT_ETIQUETTE_TYPE " , " chaine " , " L7163 " , " Type d etiquette (pour impression de planche d etiquette) " );
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
// Boites
//-------
$this -> boxes = array ();
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
// Permissions
//------------
$this -> rights = array ();
$this -> rights_class = 'adherent' ;
$r = 0 ;
// $this->rights[$r][0] Id permission (unique tous modules confondus)
2007-12-26 11:09:30 +01:00
// $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission)
// $this->rights[$r][2] Non utilise
2005-09-04 20:58:06 +02:00
// $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut
// $this->rights[$r][4] Niveau 1 pour nommer permission dans code
// $this->rights[$r][5] Niveau 2 pour nommer permission dans code
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
$r ++ ;
$this -> rights [ $r ][ 0 ] = 71 ;
2009-07-18 17:01:45 +02:00
$this -> rights [ $r ][ 1 ] = 'Read members\' card' ;
2005-09-04 20:58:06 +02:00
$this -> rights [ $r ][ 2 ] = 'r' ;
$this -> rights [ $r ][ 3 ] = 1 ;
$this -> rights [ $r ][ 4 ] = 'lire' ;
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
$r ++ ;
$this -> rights [ $r ][ 0 ] = 72 ;
2009-07-18 17:01:45 +02:00
$this -> rights [ $r ][ 1 ] = 'Create/modify members (need also user module permissions if member linked to a user)' ;
2005-09-04 20:58:06 +02:00
$this -> rights [ $r ][ 2 ] = 'w' ;
$this -> rights [ $r ][ 3 ] = 0 ;
$this -> rights [ $r ][ 4 ] = 'creer' ;
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
$r ++ ;
$this -> rights [ $r ][ 0 ] = 74 ;
2009-07-18 17:01:45 +02:00
$this -> rights [ $r ][ 1 ] = 'Remove members' ;
2005-09-04 20:58:06 +02:00
$this -> rights [ $r ][ 2 ] = 'd' ;
$this -> rights [ $r ][ 3 ] = 0 ;
$this -> rights [ $r ][ 4 ] = 'supprimer' ;
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
$r ++ ;
$this -> rights [ $r ][ 0 ] = 76 ;
2009-07-18 17:01:45 +02:00
$this -> rights [ $r ][ 1 ] = 'Export members' ;
2005-09-04 20:58:06 +02:00
$this -> rights [ $r ][ 2 ] = 'r' ;
$this -> rights [ $r ][ 3 ] = 0 ;
$this -> rights [ $r ][ 4 ] = 'export' ;
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
$r ++ ;
$this -> rights [ $r ][ 0 ] = 75 ;
2009-07-18 17:01:45 +02:00
$this -> rights [ $r ][ 1 ] = 'Setup types and attributes of members' ;
2005-09-04 20:58:06 +02:00
$this -> rights [ $r ][ 2 ] = 'w' ;
$this -> rights [ $r ][ 3 ] = 0 ;
$this -> rights [ $r ][ 4 ] = 'configurer' ;
$r ++ ;
$this -> rights [ $r ][ 0 ] = 78 ;
2009-07-18 17:01:45 +02:00
$this -> rights [ $r ][ 1 ] = 'Read subscriptions' ;
2005-09-04 20:58:06 +02:00
$this -> rights [ $r ][ 2 ] = 'r' ;
$this -> rights [ $r ][ 3 ] = 1 ;
$this -> rights [ $r ][ 4 ] = 'cotisation' ;
$this -> rights [ $r ][ 5 ] = 'lire' ;
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
$r ++ ;
$this -> rights [ $r ][ 0 ] = 79 ;
2009-07-18 17:01:45 +02:00
$this -> rights [ $r ][ 1 ] = 'Create/modify/remove subscriptions' ;
2005-09-04 20:58:06 +02:00
$this -> rights [ $r ][ 2 ] = 'w' ;
$this -> rights [ $r ][ 3 ] = 0 ;
$this -> rights [ $r ][ 4 ] = 'cotisation' ;
$this -> rights [ $r ][ 5 ] = 'creer' ;
// Exports
//--------
$r = 0 ;
// $this->export_code[$r] Code unique identifiant l'export (tous modules confondus)
2007-12-26 11:09:30 +01:00
// $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
2008-01-10 23:21:18 +01:00
// $this->export_permission[$r] Liste des codes permissions requis pour faire l'export
2005-09-04 20:58:06 +02:00
// $this->export_fields_sql[$r] Liste des champs exportables en codif sql
// $this->export_fields_name[$r] Liste des champs exportables en codif traduction
2007-12-26 11:09:30 +01:00
// $this->export_sql[$r] Requete sql qui offre les donnees a l'export
2005-09-04 20:58:06 +02:00
$r ++ ;
2008-01-17 22:37:46 +01:00
$this -> export_code [ $r ] = $this -> rights_class . '_' . $r ;
2009-03-05 12:11:32 +01:00
$this -> export_label [ $r ] = 'MembersAndSubscriptions' ;
2008-01-10 23:21:18 +01:00
$this -> export_permission [ $r ] = array ( array ( " adherent " , " export " ));
2010-03-20 21:24:32 +01:00
$this -> export_fields_array [ $r ] = array ( 'a.rowid' => 'Id' , 'a.civilite' => " UserTitle " , 'a.nom' => " Lastname " , 'a.prenom' => " Firstname " , 'a.login' => " Login " , 'a.morphy' => 'MorPhy' , 'a.adresse' => " Address " , 'a.cp' => " Zip " , 'a.ville' => " Town " , 'a.pays' => " Country " , 'a.phone' => " PhonePro " , 'a.phone_perso' => " PhonePerso " , 'a.phone_mobile' => " PhoneMobile " , 'a.email' => " Email " , 'a.naiss' => " Birthday " , 'a.statut' => " Status " , 'a.photo' => " Photo " , 'a.note' => " Note " , 'a.datec' => 'DateCreation' , 'a.datevalid' => 'DateValidation' , 'a.tms' => 'DateLastModification' , 'a.datefin' => 'DateEndSubscription' , 'ta.rowid' => 'MemberTypeId' , 'ta.libelle' => 'MemberTypeLabel' , 'c.rowid' => 'SubscriptionId' , 'c.dateadh' => 'DateSubscription' , 'c.cotisation' => 'Amount' );
$this -> export_entities_array [ $r ] = array ( 'a.rowid' => 'member' , 'a.civilite' => " member " , 'a.nom' => " member " , 'a.prenom' => " member " , 'a.login' => " member " , 'a.morphy' => 'member' , 'a.adresse' => " member " , 'a.cp' => " member " , 'a.ville' => " member " , 'a.pays' => " member " , 'a.phone' => " member " , 'a.phone_perso' => " member " , 'a.phone_mobile' => " member " , 'a.email' => " member " , 'a.naiss' => " member " , 'a.statut' => " member " , 'a.photo' => " member " , 'a.note' => " member " , 'a.datec' => 'member' , 'a.datevalid' => 'member' , 'a.tms' => 'member' , 'a.datefin' => 'member' , 'ta.rowid' => 'member_type' , 'ta.libelle' => 'member_type' , 'c.rowid' => 'subscription' , 'c.dateadh' => 'subscription' , 'c.cotisation' => 'subscription' );
$this -> export_alias_array [ $r ] = array ( 'a.rowid' => 'Id' , 'a.civilite' => " civility " , 'a.nom' => " lastname " , 'a.prenom' => " firstname " , 'a.login' => " login " , 'a.morphy' => 'morphy' , 'a.adresse' => " address " , 'a.cp' => " zip " , 'a.ville' => " town " , 'a.pays' => " country " , 'a.phone' => " phone " , 'a.phone_perso' => " phone_perso " , 'a.phone_mobile' => " phone_mobile " , 'a.email' => " email " , 'a.naiss' => " birthday " , 'a.statut' => " status " , 'a.photo' => 'photo' , 'a.note' => 'note' , 'a.datec' => 'datec' , 'a.datevalid' => 'datevalid' , 'a.tms' => 'datem' , 'a.datefin' => 'dateend' , 'ta.rowid' => 'type_id' , 'ta.libelle' => 'type_label' , 'c.rowid' => 'id_subscription' , 'c.dateadh' => 'date_subscription' , 'c.cotisation' => 'amount_subscription' );
2007-12-26 11:09:30 +01:00
// On complete avec champs options
2009-02-11 21:44:00 +01:00
$sql = 'SELECT name, label FROM ' . MAIN_DB_PREFIX . 'adherent_options_label' ;
2007-05-21 03:49:37 +02:00
$resql = $this -> db -> query ( $sql );
while ( $obj = $this -> db -> fetch_object ( $resql ))
{
$fieldname = 'ao.' . $obj -> name ;
$fieldlabel = ucfirst ( $obj -> label );
$this -> export_fields_array [ $r ][ $fieldname ] = $fieldlabel ;
$this -> export_entities_array [ $r ][ $fieldname ] = 'member' ;
$this -> export_alias_array [ $r ][ $fieldname ] = 'opt_' . $obj -> name ;
}
// Fin complement
2008-01-10 23:21:18 +01:00
$this -> export_sql_start [ $r ] = 'SELECT DISTINCT ' ;
2010-05-07 20:53:29 +02:00
$this -> export_sql_end [ $r ] = ' FROM (' . MAIN_DB_PREFIX . 'adherent_type as ta, ' . MAIN_DB_PREFIX . 'adherent as a)' ;
2009-11-07 13:05:31 +01:00
$this -> export_sql_end [ $r ] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'adherent_options as ao ON a.rowid = ao.fk_member' ;
2008-01-10 23:21:18 +01:00
$this -> export_sql_end [ $r ] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'cotisation as c ON c.fk_adherent = a.rowid' ;
$this -> export_sql_end [ $r ] .= ' WHERE a.fk_adherent_type = ta.rowid' ;
2005-09-04 20:58:06 +02:00
}
2004-11-23 21:04:19 +01:00
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
/**
2007-12-26 11:09:30 +01:00
* \brief Fonction appelee lors de l ' activation du module . Insere en base les constantes , boites , permissions du module .
* Definit egalement les repertoires de donnees a creer pour ce module .
2005-09-04 20:58:06 +02:00
*/
function init ()
{
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
$sql = array ();
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
return $this -> _init ( $sql );
}
2009-02-11 21:44:00 +01:00
2005-09-04 20:58:06 +02:00
/**
2007-12-26 11:09:30 +01:00
* \brief Fonction appelee lors de la desactivation d ' un module .
2005-09-04 20:58:06 +02:00
* Supprime de la base les constantes , boites et permissions du module .
*/
function remove ()
{
2008-01-14 23:34:27 +01:00
$sql = array ();
2009-02-11 21:44:00 +01:00
2008-01-14 23:34:27 +01:00
return $this -> _remove ( $sql );
2005-09-04 20:58:06 +02:00
}
2003-09-15 16:03:49 +02:00
}
?>