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(
"member.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(7, 0);
85 'Name of PDF model of member',
97 "ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER",
98 "emailtemplate:member",
99 "(SendingEmailOnAutoSubscription)",
104 "ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION",
105 "emailtemplate:member",
106 "(SendingEmailOnNewSubscription)",
111 "ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION",
112 "emailtemplate:member",
113 "(SendingReminderForExpiredSubscription)",
118 "ADHERENT_EMAIL_TEMPLATE_CANCELATION",
119 "emailtemplate:member",
120 "(SendingEmailOnCancelation)",
126 "ADHERENT_CARD_HEADER_TEXT",
129 "Texte imprimé sur le haut de la carte adhérent",
133 "ADHERENT_CARD_FOOTER_TEXT",
136 "Texte imprimé sur le bas de la carte adhérent",
140 "ADHERENT_CARD_TEXT",
142 "__FULLNAME__\r\nID: __ID__\r\n__EMAIL__\r\n__ADDRESS__\r\n__ZIP__ __TOWN__\r\n__COUNTRY__",
143 "Text to print on member cards",
147 "ADHERENT_MAILMAN_ADMIN_PASSWORD",
150 "Password admin mailman lists",
154 "ADHERENT_ETIQUETTE_TYPE",
157 "Type of address sheets",
161 "ADHERENT_ETIQUETTE_TEXT",
163 "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__",
164 "Text to print on member address sheets",
169 "ADHERENT_BANK_ACCOUNT",
172 "ID of bank account to use",
176 "ADHERENT_BANK_CATEGORIE",
179 "ID of bank transaction category to use",
183 "MEMBER_ADDON_PDF_ODT_PATH",
185 "DOL_DATA_ROOT".($conf->entity > 1 ?
'/'.$conf->entity :
'').
"/doctemplates/members",
193 $this->boxes = array(
194 0 => array(
'file'=>
'box_members.php',
'enabledbydefaulton'=>
'Home'),
195 2 => array(
'file'=>
'box_birthdays_members.php',
'enabledbydefaulton'=>
'Home'),
196 3 => array(
'file'=>
'box_members_last_modified.php',
'enabledbydefaulton'=>
'membersindex'),
197 4 => array(
'file'=>
'box_members_last_subscriptions.php',
'enabledbydefaulton'=>
'membersindex'),
198 5 => array(
'file'=>
'box_members_subscriptions_by_year.php',
'enabledbydefaulton'=>
'membersindex'),
199 6 => array(
'file'=>
'box_members_by_type.php',
'enabledbydefaulton'=>
'membersindex'),
200 7 => array(
'file'=>
'box_members_by_tags.php',
'enabledbydefaulton'=>
'membersindex'),
205 $this->rights = array();
206 $this->rights_class =
'adherent';
217 $this->rights[$r][0] = 71;
218 $this->rights[$r][1] =
'Read members\' card';
219 $this->rights[$r][2] =
'r';
220 $this->rights[$r][3] = 0;
221 $this->rights[$r][4] =
'lire';
224 $this->rights[$r][0] = 72;
225 $this->rights[$r][1] =
'Create/modify members (need also user module permissions if member linked to a user)';
226 $this->rights[$r][2] =
'w';
227 $this->rights[$r][3] = 0;
228 $this->rights[$r][4] =
'creer';
231 $this->rights[$r][0] = 74;
232 $this->rights[$r][1] =
'Remove members';
233 $this->rights[$r][2] =
'd';
234 $this->rights[$r][3] = 0;
235 $this->rights[$r][4] =
'supprimer';
238 $this->rights[$r][0] = 76;
239 $this->rights[$r][1] =
'Export members';
240 $this->rights[$r][2] =
'r';
241 $this->rights[$r][3] = 0;
242 $this->rights[$r][4] =
'export';
245 $this->rights[$r][0] = 75;
246 $this->rights[$r][1] =
'Setup types of membership';
247 $this->rights[$r][2] =
'w';
248 $this->rights[$r][3] = 0;
249 $this->rights[$r][4] =
'configurer';
252 $this->rights[$r][0] = 78;
253 $this->rights[$r][1] =
'Read membership fees';
254 $this->rights[$r][2] =
'r';
255 $this->rights[$r][3] = 0;
256 $this->rights[$r][4] =
'cotisation';
257 $this->rights[$r][5] =
'lire';
260 $this->rights[$r][0] = 79;
261 $this->rights[$r][1] =
'Create/modify/remove membership fees';
262 $this->rights[$r][2] =
'w';
263 $this->rights[$r][3] = 0;
264 $this->rights[$r][4] =
'cotisation';
265 $this->rights[$r][5] =
'creer';
285 $this->export_code[$r] = $this->rights_class.
'_'.$r;
286 $this->export_label[$r] =
'MembersAndSubscriptions';
287 $this->export_permission[$r] = array(array(
"adherent",
"export"));
288 $this->export_fields_array[$r] = array(
289 'a.rowid'=>
'MemberId',
'a.ref'=>
'MemberRef',
'a.civility'=>
"UserTitle",
'a.lastname'=>
"Lastname",
'a.firstname'=>
"Firstname",
'a.login'=>
"Login",
'a.gender'=>
"Gender",
'a.morphy'=>
'MemberNature',
290 'a.societe'=>
'Company',
'a.address'=>
"Address",
'a.zip'=>
"Zip",
'a.town'=>
"Town",
'd.code_departement'=>
'StateCode',
'd.nom'=>
"State",
'co.code'=>
"CountryCode",
'co.label'=>
"Country",
291 'a.phone'=>
"PhonePro",
'a.phone_perso'=>
"PhonePerso",
'a.phone_mobile'=>
"PhoneMobile",
'a.email'=>
"Email",
'a.birth'=>
"Birthday",
'a.statut'=>
"Status",
292 'a.photo'=>
"Photo",
'a.note_public'=>
"NotePublic",
'a.note_private'=>
"NotePrivate",
'a.datec'=>
'DateCreation',
'a.datevalid'=>
'DateValidation',
293 'a.tms'=>
'DateLastModification',
'a.datefin'=>
'DateEndSubscription',
'ta.rowid'=>
'MemberTypeId',
'ta.libelle'=>
'MemberTypeLabel',
294 'c.rowid'=>
'SubscriptionId',
'c.dateadh'=>
'DateSubscription',
'c.datef'=>
'DateEndSubscription',
'c.subscription'=>
'Amount'
296 $this->export_TypeFields_array[$r] = array(
297 'a.civility'=>
"Text",
'a.lastname'=>
"Text",
'a.firstname'=>
"Text",
'a.login'=>
"Text",
'a.gender'=>
'Text',
'a.morphy'=>
'Text',
'a.societe'=>
'Text',
'a.address'=>
"Text",
298 '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",
299 'a.email'=>
"Text",
'a.birth'=>
"Date",
'a.statut'=>
"Status",
'a.note_public'=>
"Text",
'a.note_private'=>
"Text",
'a.datec'=>
'Date',
'a.datevalid'=>
'Date',
300 'a.tms'=>
'Date',
'a.datefin'=>
'Date',
'ta.rowid'=>
'List:adherent_type:libelle::member_type',
'ta.libelle'=>
'Text',
301 'c.rowid'=>
'Numeric',
'c.dateadh'=>
'Date',
'c.datef'=>
'Date',
'c.subscription'=>
'Numeric'
303 $this->export_entities_array[$r] = array(
304 'a.rowid'=>
'member',
'a.ref'=>
'member',
'a.civility'=>
"member",
'a.lastname'=>
"member",
'a.firstname'=>
"member",
'a.login'=>
"member",
'a.gender'=>
'member',
'a.morphy'=>
'member',
305 'a.societe'=>
'member',
'a.address'=>
"member",
'a.zip'=>
"member",
'a.town'=>
"member",
'd.nom'=>
"member",
'co.code'=>
"member",
'co.label'=>
"member",
306 'a.phone'=>
"member",
'a.phone_perso'=>
"member",
'a.phone_mobile'=>
"member",
'a.email'=>
"member",
'a.birth'=>
"member",
'a.statut'=>
"member",
307 'a.photo'=>
"member",
'a.note_public'=>
"member",
'a.note_private'=>
"member",
'a.datec'=>
'member',
'a.datevalid'=>
'member',
'a.tms'=>
'member',
308 'a.datefin'=>
'member',
'ta.rowid'=>
'member_type',
'ta.libelle'=>
'member_type',
309 'c.rowid'=>
'subscription',
'c.dateadh'=>
'subscription',
'c.datef'=>
'subscription',
'c.subscription'=>
'subscription'
312 $keyforselect =
'adherent';
313 $keyforelement =
'member';
314 $keyforaliasextra =
'extra';
315 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
317 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
318 $this->export_sql_end[$r] =
' FROM ('.MAIN_DB_PREFIX.
'adherent_type as ta, '.MAIN_DB_PREFIX.
'adherent as a)';
319 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'adherent_extrafields as extra ON a.rowid = extra.fk_object';
320 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'subscription as c ON c.fk_adherent = a.rowid';
321 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_departements as d ON a.state_id = d.rowid';
322 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as co ON a.country = co.rowid';
323 $this->export_sql_end[$r] .=
' WHERE a.fk_adherent_type = ta.rowid AND ta.entity IN ('.getEntity(
'member_type').
') ';
324 $this->export_dependencies_array[$r] = array(
'subscription'=>
'c.rowid');
331 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
334 $this->import_code[$r] = $this->rights_class.
'_'.$r;
335 $this->import_label[$r] =
"Members";
336 $this->import_icon[$r] = $this->picto;
337 $this->import_entities_array[$r] = array();
338 $this->import_tables_array[$r] = array(
'a'=>MAIN_DB_PREFIX.
'adherent',
'extra'=>MAIN_DB_PREFIX.
'adherent_extrafields');
339 $this->import_tables_creator_array[$r] = array(
'a'=>
'fk_user_author');
340 $this->import_fields_array[$r] = array(
341 'a.ref' =>
'MemberRef*',
342 'a.civility'=>
"UserTitle",
'a.lastname'=>
"Lastname*",
'a.firstname'=>
"Firstname",
'a.gender'=>
"Gender",
'a.login'=>
"Login*",
"a.pass"=>
"Password",
343 "a.fk_adherent_type"=>
"MemberTypeId*",
'a.morphy'=>
'MemberNature*',
'a.societe'=>
'Company',
'a.address'=>
"Address",
'a.zip'=>
"Zip",
'a.town'=>
"Town",
344 'a.state_id'=>
'StateId|StateCode',
'a.country'=>
"CountryId|CountryCode",
'a.phone'=>
"PhonePro",
'a.phone_perso'=>
"PhonePerso",
'a.phone_mobile'=>
"PhoneMobile",
345 'a.email'=>
"Email",
'a.birth'=>
"Birthday",
'a.statut'=>
"Status*",
'a.photo'=>
"Photo",
'a.note_public'=>
"NotePublic",
'a.note_private'=>
"NotePrivate",
346 'a.datec'=>
'DateCreation',
'a.datefin'=>
'DateEndSubscription'
349 $this->import_fields_array[$r][
'a.fk_soc'] =
"ThirdParty";
352 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'adherent' AND entity IN (0,".$conf->entity.
")";
353 $resql = $this->db->query($sql);
355 while ($obj = $this->db->fetch_object($resql)) {
356 $fieldname =
'extra.'.$obj->name;
357 $fieldlabel = ucfirst($obj->label);
358 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
362 $this->import_convertvalue_array[$r] = array(
364 'rule'=>
'getrefifauto',
366 'path'=>
"/core/modules/member/".
getDolGlobalString(
'MEMBER_ADDON',
'mod_member_simple').
'.php'
368 'a.state_id' => array(
369 'rule' =>
'fetchidfromcodeid',
370 'classfile' =>
'/core/class/cstate.class.php',
373 'dict' =>
'DictionaryStateCode'
375 'a.country' => array(
376 'rule' =>
'fetchidfromcodeid',
377 'classfile' =>
'/core/class/ccountry.class.php',
378 'class' =>
'Ccountry',
380 'dict' =>
'DictionaryCountry'
384 $this->import_convertvalue_array[$r][
'a.fk_soc'] = array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/societe/class/societe.class.php',
'class'=>
'Societe',
'method'=>
'fetch',
'element'=>
'ThirdParty');
386 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object'=>
'lastrowid-'.MAIN_DB_PREFIX.
'adherent');
387 $this->import_regex_array[$r] = array(
388 'a.civility'=>
'code@'.MAIN_DB_PREFIX.
'c_civility',
'a.fk_adherent_type'=>
'rowid@'.MAIN_DB_PREFIX.
'adherent_type',
'a.morphy'=>
'(phy|mor)',
389 '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]$');
390 $this->import_examplevalues_array[$r] = array(
391 'a.ref'=>
"auto or MEM2010-1234",
392 'a.civility'=>
"MR",
'a.lastname'=>
'Smith',
'a.firstname'=>
'John',
'a.gender'=>
'man or woman',
'a.login'=>
'jsmith',
'a.pass'=>
'passofjsmith',
'a.fk_adherent_type'=>
'1',
393 'a.morphy'=>
'"mor" or "phy"',
'a.societe'=>
'JS company',
'a.address'=>
'21 jump street',
'a.zip'=>
'55000',
'a.town'=>
'New York',
'a.country'=>
'1',
394 '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",
398 $this->import_examplevalues_array[$r][
'a.fk_soc'] =
"rowid or name";
400 $this->import_updatekeys_array[$r] = array(
'a.ref'=>
'MemberRef',
'a.login'=>
'Login');
404 $this->import_code[$r] = $this->rights_class.
'_'.$r;
405 $this->import_label[$r] =
"Subscriptions";
406 $this->import_icon[$r] = $this->picto;
407 $this->import_entities_array[$r] = array();
408 $this->import_tables_array[$r] = array(
'c'=>MAIN_DB_PREFIX.
'subscription');
409 $this->import_fields_array[$r] = array(
410 'c.fk_adherent' =>
'MemberRef*',
411 'c.note'=>
'Note',
'c.dateadh'=>
'DateSubscription',
'c.datef'=>
'DateEndSubscription',
'c.subscription'=>
'Amount',
'c.fk_type' =>
'MemberType',
'c.fk_bank' =>
'Bank'
413 $this->import_convertvalue_array[$r] = array(
414 'c.fk_adherent' => array(
415 'rule'=>
'fetchidfromref',
416 'classfile'=>
'/adherents/class/adherent.class.php',
422 $this->import_examplevalues_array[$r] = array(
423 'c.fk_adherent' =>
'member ref',
424 'c.note'=>
'Subscription #33',
'c.dateadh'=>
'2025-09-01',
'c.datef'=>
'2026-08-31',
'c.subscription'=>
'50'
429 $datestart =
dol_mktime(22, 0, 0, $arraydate[
'mon'], $arraydate[
'mday'], $arraydate[
'year']);
430 $this->cronjobs = array(
432 'label'=>
'SendReminderForExpiredSubscriptionTitle',
433 'jobtype'=>
'method',
'class'=>
'adherents/class/adherent.class.php',
434 'objectname'=>
'Adherent',
435 'method'=>
'sendReminderForExpiredSubscription',
436 'parameters'=>
'10;0',
437 'comment'=>
'SendReminderForExpiredSubscription',
439 'unitfrequency'=> 3600 * 24,
442 'test'=>
'isModEnabled("member")',
443 'datestart'=>$datestart