32 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
53 $this->module_position =
'06';
55 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
56 $this->
description =
"Management of members of a foundation or association";
58 $this->version =
'dolibarr';
59 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
60 $this->picto =
'member';
65 "/doctemplates/members",
69 $this->config_page_url = array(
"adherent.php@adherents");
72 $this->hidden =
false;
73 $this->depends = array();
74 $this->requiredby = array();
75 $this->conflictwith = array(
'modMailmanSpip');
76 $this->langfiles = array(
"members",
"companies");
77 $this->phpmin = array(5, 4);
80 $this->
const = array();
83 $this->
const[$r][0] =
"ADHERENT_ADDON_PDF";
84 $this->
const[$r][1] =
"chaine";
85 $this->
const[$r][2] =
"standard";
86 $this->
const[$r][3] =
'Name of PDF model of member';
87 $this->
const[$r][4] = 0;
91 $this->
const[$r][0] =
"ADHERENT_MAIL_FROM";
92 $this->
const[$r][1] =
"chaine";
93 $this->
const[$r][2] =
"";
94 $this->
const[$r][3] =
"From des mails";
95 $this->
const[$r][4] = 0;
98 $this->
const[$r][0] =
"ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER";
99 $this->
const[$r][1] =
"emailtemplate:member";
100 $this->
const[$r][2] =
"(SendingEmailOnAutoSubscription)";
101 $this->
const[$r][3] =
"";
102 $this->
const[$r][4] = 0;
105 $this->
const[$r][0] =
"ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION";
106 $this->
const[$r][1] =
"emailtemplate:member";
107 $this->
const[$r][2] =
"(SendingEmailOnNewSubscription)";
108 $this->
const[$r][3] =
"";
109 $this->
const[$r][4] = 0;
112 $this->
const[$r][0] =
"ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION";
113 $this->
const[$r][1] =
"emailtemplate:member";
114 $this->
const[$r][2] =
"(SendingReminderForExpiredSubscription)";
115 $this->
const[$r][3] =
"";
116 $this->
const[$r][4] = 0;
119 $this->
const[$r][0] =
"ADHERENT_EMAIL_TEMPLATE_CANCELATION";
120 $this->
const[$r][1] =
"emailtemplate:member";
121 $this->
const[$r][2] =
"(SendingEmailOnCancelation)";
122 $this->
const[$r][3] =
"";
123 $this->
const[$r][4] = 0;
127 $this->
const[$r][0] =
"ADHERENT_CARD_HEADER_TEXT";
128 $this->
const[$r][1] =
"chaine";
129 $this->
const[$r][2] =
"__YEAR__";
130 $this->
const[$r][3] =
"Texte imprimé sur le haut de la carte adhérent";
131 $this->
const[$r][4] = 0;
134 $this->
const[$r][0] =
"ADHERENT_CARD_FOOTER_TEXT";
135 $this->
const[$r][1] =
"chaine";
136 $this->
const[$r][2] =
"__COMPANY__";
137 $this->
const[$r][3] =
"Texte imprimé sur le bas de la carte adhérent";
138 $this->
const[$r][4] = 0;
141 $this->
const[$r][0] =
"ADHERENT_CARD_TEXT";
142 $this->
const[$r][1] =
"texte";
143 $this->
const[$r][2] =
"__FULLNAME__\r\nID: __ID__\r\n__EMAIL__\r\n__ADDRESS__\r\n__ZIP__ __TOWN__\r\n__COUNTRY__";
144 $this->
const[$r][3] =
"Text to print on member cards";
145 $this->
const[$r][4] = 0;
148 $this->
const[$r][0] =
"ADHERENT_MAILMAN_ADMINPW";
149 $this->
const[$r][1] =
"chaine";
150 $this->
const[$r][2] =
"";
151 $this->
const[$r][3] =
"Mot de passe Admin des liste mailman";
152 $this->
const[$r][4] = 0;
155 $this->
const[$r][0] =
"ADHERENT_ETIQUETTE_TYPE";
156 $this->
const[$r][1] =
"chaine";
157 $this->
const[$r][2] =
"L7163";
158 $this->
const[$r][3] =
"Type of address sheets";
159 $this->
const[$r][4] = 0;
162 $this->
const[$r][0] =
"ADHERENT_ETIQUETTE_TEXT";
163 $this->
const[$r][1] =
"texte";
164 $this->
const[$r][2] =
"__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY%";
165 $this->
const[$r][3] =
"Text to print on member address sheets";
166 $this->
const[$r][4] = 0;
170 $this->
const[$r][0] =
"ADHERENT_BANK_ACCOUNT";
171 $this->
const[$r][1] =
"chaine";
172 $this->
const[$r][2] =
"";
173 $this->
const[$r][3] =
"ID of bank account to use";
174 $this->
const[$r][4] = 0;
177 $this->
const[$r][0] =
"ADHERENT_BANK_CATEGORIE";
178 $this->
const[$r][1] =
"chaine";
179 $this->
const[$r][2] =
"";
180 $this->
const[$r][3] =
"ID of bank transaction category to use";
181 $this->
const[$r][4] = 0;
184 $this->
const[$r][0] =
"MEMBER_ADDON_PDF_ODT_PATH";
185 $this->
const[$r][1] =
"chaine";
186 $this->
const[$r][2] =
"DOL_DATA_ROOT/doctemplates/members";
187 $this->
const[$r][3] =
"";
188 $this->
const[$r][4] = 0;
194 $this->boxes = array(
195 0=>array(
'file'=>
'box_members.php',
'enabledbydefaulton'=>
'Home'),
196 2=>array(
'file'=>
'box_birthdays_members.php',
'enabledbydefaulton'=>
'Home')
201 $this->rights = array();
202 $this->rights_class =
'adherent';
213 $this->rights[$r][0] = 71;
214 $this->rights[$r][1] =
'Read members\' card';
215 $this->rights[$r][2] =
'r';
216 $this->rights[$r][3] = 0;
217 $this->rights[$r][4] =
'lire';
220 $this->rights[$r][0] = 72;
221 $this->rights[$r][1] =
'Create/modify members (need also user module permissions if member linked to a user)';
222 $this->rights[$r][2] =
'w';
223 $this->rights[$r][3] = 0;
224 $this->rights[$r][4] =
'creer';
227 $this->rights[$r][0] = 74;
228 $this->rights[$r][1] =
'Remove members';
229 $this->rights[$r][2] =
'd';
230 $this->rights[$r][3] = 0;
231 $this->rights[$r][4] =
'supprimer';
234 $this->rights[$r][0] = 76;
235 $this->rights[$r][1] =
'Export members';
236 $this->rights[$r][2] =
'r';
237 $this->rights[$r][3] = 0;
238 $this->rights[$r][4] =
'export';
241 $this->rights[$r][0] = 75;
242 $this->rights[$r][1] =
'Setup types of membership';
243 $this->rights[$r][2] =
'w';
244 $this->rights[$r][3] = 0;
245 $this->rights[$r][4] =
'configurer';
248 $this->rights[$r][0] = 78;
249 $this->rights[$r][1] =
'Read subscriptions';
250 $this->rights[$r][2] =
'r';
251 $this->rights[$r][3] = 0;
252 $this->rights[$r][4] =
'cotisation';
253 $this->rights[$r][5] =
'lire';
256 $this->rights[$r][0] = 79;
257 $this->rights[$r][1] =
'Create/modify/remove subscriptions';
258 $this->rights[$r][2] =
'w';
259 $this->rights[$r][3] = 0;
260 $this->rights[$r][4] =
'cotisation';
261 $this->rights[$r][5] =
'creer';
281 $this->export_code[$r] = $this->rights_class.
'_'.$r;
282 $this->export_label[$r] =
'MembersAndSubscriptions';
283 $this->export_permission[$r] = array(array(
"adherent",
"export"));
284 $this->export_fields_array[$r] = array(
285 'a.rowid'=>
'Id',
'a.civility'=>
"UserTitle",
'a.lastname'=>
"Lastname",
'a.firstname'=>
"Firstname",
'a.login'=>
"Login",
'a.gender'=>
"Gender",
'a.morphy'=>
'Nature',
286 'a.societe'=>
'Company',
'a.address'=>
"Address",
'a.zip'=>
"Zip",
'a.town'=>
"Town",
'd.nom'=>
"State",
'co.code'=>
"CountryCode",
'co.label'=>
"Country",
287 'a.phone'=>
"PhonePro",
'a.phone_perso'=>
"PhonePerso",
'a.phone_mobile'=>
"PhoneMobile",
'a.email'=>
"Email",
'a.birth'=>
"Birthday",
'a.statut'=>
"Status",
288 'a.photo'=>
"Photo",
'a.note_public'=>
"NotePublic",
'a.note_private'=>
"NotePrivate",
'a.datec'=>
'DateCreation',
'a.datevalid'=>
'DateValidation',
289 'a.tms'=>
'DateLastModification',
'a.datefin'=>
'DateEndSubscription',
'ta.rowid'=>
'MemberTypeId',
'ta.libelle'=>
'MemberTypeLabel',
290 'c.rowid'=>
'SubscriptionId',
'c.dateadh'=>
'DateSubscription',
'c.datef'=>
'DateEndSubscription',
'c.subscription'=>
'Amount'
292 $this->export_TypeFields_array[$r] = array(
293 'a.civility'=>
"Text",
'a.lastname'=>
"Text",
'a.firstname'=>
"Text",
'a.login'=>
"Text",
'a.gender'=>
'Text',
'a.morphy'=>
'Text',
'a.societe'=>
'Text',
'a.address'=>
"Text",
294 'a.zip'=>
"Text",
'a.town'=>
"Text",
'd.nom'=>
"Text",
'co.code'=>
'Text',
'co.label'=>
"Text",
'a.phone'=>
"Text",
'a.phone_perso'=>
"Text",
'a.phone_mobile'=>
"Text",
295 'a.email'=>
"Text",
'a.birth'=>
"Date",
'a.statut'=>
"Status",
'a.note_public'=>
"Text",
'a.note_private'=>
"Text",
'a.datec'=>
'Date',
'a.datevalid'=>
'Date',
296 'a.tms'=>
'Date',
'a.datefin'=>
'Date',
'ta.rowid'=>
'List:adherent_type:libelle::member_type',
'ta.libelle'=>
'Text',
297 'c.rowid'=>
'Numeric',
'c.dateadh'=>
'Date',
'c.datef'=>
'Date',
'c.subscription'=>
'Numeric'
299 $this->export_entities_array[$r] = array(
300 'a.rowid'=>
'member',
'a.civility'=>
"member",
'a.lastname'=>
"member",
'a.firstname'=>
"member",
'a.login'=>
"member",
'a.gender'=>
'member',
'a.morphy'=>
'member',
301 'a.societe'=>
'member',
'a.address'=>
"member",
'a.zip'=>
"member",
'a.town'=>
"member",
'd.nom'=>
"member",
'co.code'=>
"member",
'co.label'=>
"member",
302 'a.phone'=>
"member",
'a.phone_perso'=>
"member",
'a.phone_mobile'=>
"member",
'a.email'=>
"member",
'a.birth'=>
"member",
'a.statut'=>
"member",
303 'a.photo'=>
"member",
'a.note_public'=>
"member",
'a.note_private'=>
"member",
'a.datec'=>
'member',
'a.datevalid'=>
'member',
'a.tms'=>
'member',
304 'a.datefin'=>
'member',
'ta.rowid'=>
'member_type',
'ta.libelle'=>
'member_type',
305 'c.rowid'=>
'subscription',
'c.dateadh'=>
'subscription',
'c.datef'=>
'subscription',
'c.subscription'=>
'subscription'
308 $keyforselect =
'adherent'; $keyforelement =
'member'; $keyforaliasextra =
'extra';
309 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
311 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
312 $this->export_sql_end[$r] =
' FROM ('.MAIN_DB_PREFIX.
'adherent_type as ta, '.MAIN_DB_PREFIX.
'adherent as a)';
313 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'adherent_extrafields as extra ON a.rowid = extra.fk_object';
314 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'subscription as c ON c.fk_adherent = a.rowid';
315 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_departements as d ON a.state_id = d.rowid';
316 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as co ON a.country = co.rowid';
317 $this->export_sql_end[$r] .=
' WHERE a.fk_adherent_type = ta.rowid AND ta.entity IN ('.getEntity(
'member_type').
') ';
318 $this->export_dependencies_array[$r] = array(
'subscription'=>
'c.rowid');
325 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
328 $this->import_code[$r] = $this->rights_class.
'_'.$r;
329 $this->import_label[$r] =
"Members";
330 $this->import_icon[$r] = $this->picto;
331 $this->import_entities_array[$r] = array();
332 $this->import_tables_array[$r] = array(
'a'=>MAIN_DB_PREFIX.
'adherent',
'extra'=>MAIN_DB_PREFIX.
'adherent_extrafields');
333 $this->import_tables_creator_array[$r] = array(
'a'=>
'fk_user_author');
334 $this->import_fields_array[$r] = array(
335 'a.civility'=>
"UserTitle",
'a.lastname'=>
"Lastname*",
'a.firstname'=>
"Firstname",
'a.gender'=>
"Gender",
'a.login'=>
"Login*",
"a.pass"=>
"Password",
336 "a.fk_adherent_type"=>
"MemberType*",
'a.morphy'=>
'Nature*',
'a.societe'=>
'Company',
'a.address'=>
"Address",
'a.zip'=>
"Zip",
'a.town'=>
"Town",
337 'a.state_id'=>
'StateId',
'a.country'=>
"CountryId",
'a.phone'=>
"PhonePro",
'a.phone_perso'=>
"PhonePerso",
'a.phone_mobile'=>
"PhoneMobile",
338 'a.email'=>
"Email",
'a.birth'=>
"Birthday",
'a.statut'=>
"Status*",
'a.photo'=>
"Photo",
'a.note_public'=>
"NotePublic",
'a.note_private'=>
"NotePrivate",
339 'a.datec'=>
'DateCreation',
'a.datefin'=>
'DateEndSubscription'
342 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.
")";
346 while ($obj = $this->
db->fetch_object(
$resql))
348 $fieldname =
'extra.'.$obj->name;
349 $fieldlabel = ucfirst($obj->label);
350 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
354 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object'=>
'lastrowid-'.MAIN_DB_PREFIX.
'adherent');
355 $this->import_regex_array[$r] = array(
356 'a.civility'=>
'code@'.MAIN_DB_PREFIX.
'c_civility',
'a.fk_adherent_type'=>
'rowid@'.MAIN_DB_PREFIX.
'adherent_type',
'a.morphy'=>
'(phy|mor)',
357 'a.statut'=>
'^[0|1]',
'a.datec'=>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
'a.datefin'=>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
358 $this->import_examplevalues_array[$r] = array(
359 'a.civility'=>
"MR",
'a.lastname'=>
'Smith',
'a.firstname'=>
'John',
'a.login'=>
'jsmith',
'a.pass'=>
'passofjsmith',
'a.fk_adherent_type'=>
'1',
360 'a.morphy'=>
'"mor" or "phy"',
'a.societe'=>
'JS company',
'a.address'=>
'21 jump street',
'a.zip'=>
'55000',
'a.town'=>
'New York',
'a.country'=>
'1',
361 'a.email'=>
'jsmith@example.com',
'a.birth'=>
'1972-10-10',
'a.statut'=>
"0 or 1",
'a.note_public'=>
"This is a public comment on member",
367 $datestart =
dol_mktime(22, 0, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
368 $this->cronjobs = array(
370 'label'=>
'SendReminderForExpiredSubscriptionTitle',
371 'jobtype'=>
'method',
'class'=>
'adherents/class/adherent.class.php',
372 'objectname'=>
'Adherent',
373 'method'=>
'sendReminderForExpiredSubscription',
374 'parameters'=>
'10;0',
375 'comment'=>
'SendReminderForExpiredSubscription',
377 'unitfrequency'=> 3600 * 24,
380 'test'=>
'$conf->adherent->enabled',
381 'datestart'=>$datestart
395 public function init($options =
'')
397 global $conf, $langs;
400 $this->
remove($options);
422 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = '".$this->db->escape($this->const[0][2]).
"' AND type='member' AND entity = ".$conf->entity,
423 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('".$this->
db->escape($this->
const[0][2]).
"','member',".$conf->entity.
")"
426 return $this->
_init($sql, $options);
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
dol_now($mode= 'auto')
Return date for now.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
Class to describe and enable module Adherent.
__construct($db)
Constructor.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
_init($array_sql, $options= '')
Enables a module.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
init($options= '')
Function called when module is enabled.
dol_time_plus_duree($time, $duration_value, $duration_unit)
Add a delay to a date.