dolibarr 24.0.0-beta
member.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
6 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
7 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
8 * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
9 * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
10 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
11 * Copyright (C) 2020-2025 Frédéric France <frederic.france@free.fr>
12 * Copyright (C) 2023 Waël Almoman <info@almoman.com>
13 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
14 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program. If not, see <https://www.gnu.org/licenses/>.
28 */
29
36// Load Dolibarr environment
37require '../../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
48require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
49require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
50
51// Load translation files required by the page
52$langs->loadLangs(array("admin", "members", "other"));
53
54if (!$user->admin) {
56}
57
58
59$choices = array('yesno', 'texte', 'chaine');
60
61$value = GETPOST('value', 'alpha');
62$label = GETPOST('label', 'alpha');
63$scandir = GETPOST('scandir', 'alpha');
64$type = 'member';
65
66$action = GETPOST('action', 'aZ09');
67$modulepart = GETPOST('modulepart', 'aZ09');
68
69$reg = array();
70$error = 0;
71
72
73/*
74 * Actions
75 */
76
77include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
78
79if ($action == 'updateMask') {
80 $maskconst = GETPOST('maskconst', 'aZ09');
81 $maskvalue = GETPOST('maskvalue', 'alpha');
82
83 $res = 0;
84
85 if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
86 $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
87 }
88
89 if (!($res > 0)) {
90 $error++;
91 }
92
93 if (!$error) {
94 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
95 } else {
96 setEventMessages($langs->trans("Error"), null, 'errors');
97 }
98} elseif ($action == 'specimen') { // For fiche expensereport
99 $modele = GETPOST('module', 'alpha');
100
101 $adherentspecimen = new Adherent($db);
102 $adherentspecimen->initAsSpecimen();
103 $adherentspecimen->status = 0; // Force statut draft to show watermark
104
105 // Search template files
106 $file = '';
107 $classname = '';
108 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
109 foreach ($dirmodels as $reldir) {
110 $file = dol_buildpath($reldir."core/modules/member/doc/pdf_".$modele.".modules.php", 0);
111 if (file_exists($file)) {
112 $classname = "pdf_".$modele;
113 break;
114 }
115 }
116
117 if ($classname !== '') {
118 require_once $file;
119
120 $module = new $classname($db);
121 '@phan-var-force ModelePDFMember $module';
124 if ($module->write_file($adherentspecimen, $langs) > 0) {
125 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=member&file=SPECIMEN.pdf");
126 return;
127 } else {
128 setEventMessages($module->error, $module->errors, 'errors');
129 dol_syslog($module->error, LOG_ERR);
130 }
131 } else {
132 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
133 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
134 }
135} elseif ($action == 'set_default') {
136 $ret = addDocumentModel($value, $type, $label, $scandir);
137 $res = true;
138} elseif ($action == 'del_default') {
139 $ret = delDocumentModel($value, $type);
140 if ($ret > 0) {
141 if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == "$value") {
142 dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
143 }
144 }
145 $res = true;
146} elseif ($action == 'setdoc') {
147 // Set default model
148 dolibarr_set_const($db, "MEMBER_ADDON_PDF_ODT", $value, 'chaine', 0, '', $conf->entity);
149
150 // We activate the model
151 $ret = delDocumentModel($value, $type);
152 if ($ret > 0) {
153 $ret = addDocumentModel($value, $type, $label, $scandir);
154 }
155 $res = true;
156} elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
157 $code = $reg[1];
158 if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
159 header("Location: ".$_SERVER["PHP_SELF"]);
160 exit;
161 } else {
163 }
164} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
165 $code = $reg[1];
166 if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
167 header("Location: ".$_SERVER["PHP_SELF"]);
168 exit;
169 } else {
171 }
172} elseif ($action == 'updatemainoptions') {
173 $db->begin();
174 $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = $res7 = $res8 = $res9 = 0;
175 $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
176 $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
177 $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
178 $res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity);
179 $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
180 if (GETPOSTISSET('MEMBER_PUBLIC_ENABLED')) {
181 $res7 = dolibarr_set_const($db, 'MEMBER_PUBLIC_ENABLED', GETPOST('MEMBER_PUBLIC_ENABLED', 'alpha'), 'chaine', 0, '', $conf->entity);
182 }
183 $res8 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', GETPOST('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', 'alpha'), 'chaine', 0, '', $conf->entity);
184 $res9 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_AFTER', GETPOST('MEMBER_SUBSCRIPTION_START_AFTER', 'alpha'), 'chaine', 0, '', $conf->entity);
185 // Use vat for invoice creation
186 if (isModEnabled('invoice')) {
187 $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
188 $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
189 if (isModEnabled("product") || isModEnabled("service")) {
190 $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
191 }
192 }
193 if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0 || $res9 < 0) {
194 setEventMessages('ErrorFailedToSaveData', null, 'errors');
195 $db->rollback();
196 } else {
197 setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
198 $db->commit();
199 }
200} elseif ($action == 'updatememberscards') {
201 $db->begin();
202 $res1 = $res2 = $res3 = $res4 = 0;
203 $res1 = dolibarr_set_const($db, 'ADHERENT_CARD_TYPE', GETPOST('ADHERENT_CARD_TYPE'), 'chaine', 0, '', $conf->entity);
204 $res2 = dolibarr_set_const($db, 'ADHERENT_CARD_HEADER_TEXT', GETPOST('ADHERENT_CARD_HEADER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
205 $res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT', GETPOST('ADHERENT_CARD_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
206 $res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT_RIGHT', GETPOST('ADHERENT_CARD_TEXT_RIGHT', 'alpha'), 'chaine', 0, '', $conf->entity);
207 $res4 = dolibarr_set_const($db, 'ADHERENT_CARD_FOOTER_TEXT', GETPOST('ADHERENT_CARD_FOOTER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
208
209 if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0) {
210 setEventMessages('ErrorFailedToSaveDate', null, 'errors');
211 $db->rollback();
212 } else {
213 setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
214 $db->commit();
215 }
216} elseif ($action == 'updatememberstickets') {
217 $db->begin();
218 $res1 = $res2 = 0;
219 $res1 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TYPE', GETPOST('ADHERENT_ETIQUETTE_TYPE'), 'chaine', 0, '', $conf->entity);
220 $res2 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TEXT', GETPOST('ADHERENT_ETIQUETTE_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
221
222 if ($res1 < 0 || $res2 < 0) {
223 setEventMessages('ErrorFailedToSaveDate', null, 'errors');
224 $db->rollback();
225 } else {
226 setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
227 $db->commit();
228 }
229} elseif ($action == 'setcodemember') {
230 $result = dolibarr_set_const($db, "MEMBER_CODEMEMBER_ADDON", $value, 'chaine', 0, '', $conf->entity);
231 if ($result <= 0) {
233 }
234} elseif ($action == 'update' || $action == 'add') {
235 // Action to update or add a constant
236 $constname = GETPOST('constname', 'alpha');
237 $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
238
239
240 if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) {
241 $constvalue = '';
242 }
243 if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') { // Invert choice
244 if ($constvalue) {
245 $constvalue = 0;
246 } else {
247 $constvalue = 1;
248 }
249 }
250
251 $consttype = GETPOSTINT('consttype');
252 $constnote = GETPOST('constnote');
253 $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
254
255 if (!($res > 0)) {
256 $error++;
257 }
258
259 if (!$error) {
260 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
261 } else {
262 setEventMessages($langs->trans("Error"), null, 'errors');
263 }
264}
265
266// Action to enable of a submodule of the adherent module
267if ($action == 'set') {
268 $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
269 if ($result < 0) {
270 print $db->error();
271 }
272}
273
274// Action to disable a submodule of the adherent module
275if ($action == 'unset') {
276 $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
277 if ($result < 0) {
278 print $db->error();
279 }
280}
281
282
283
284/*
285 * View
286 */
287
288$form = new Form($db);
289
290$title = $langs->trans("MembersSetup");
291$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
292
293llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-admin');
294
295$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
296
297print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
298
299
301
302print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user');
303
304$dirModMember = array_merge(array('/core/modules/member/'), (array) $conf->modules_parts['member']);
305foreach ($conf->modules_parts['models'] as $mo) {
306 //Add more models
307 $dirModMember[] = $mo.'core/modules/member/';
308}
309
310// Module to manage customer/supplier code
311
312print load_fiche_titre($langs->trans("MemberCodeChecker"), '', '');
313
314print '<div class="div-table-responsive-no-min">';
315print '<table class="noborder centpercent">'."\n";
316print '<tr class="liste_titre">'."\n";
317print ' <td>'.$langs->trans("Name").'</td>';
318print ' <td>'.$langs->trans("Description").'</td>';
319print ' <td>'.$langs->trans("Example").'</td>';
320print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
321print ' <td class="center" width="60"></td>';
322print "</tr>\n";
323
324$arrayofmodules = array();
325
326foreach ($dirModMember as $dirroot) {
327 $dir = dol_buildpath($dirroot, 0);
328
329 $handle = @opendir($dir);
330 if (is_resource($handle)) {
331 // Loop on each module find in opened directory
332 while (($file = readdir($handle)) !== false) {
333 // module filename has to start with mod_member_
334 if (substr($file, 0, 11) == 'mod_member_' && substr($file, -3) == 'php') {
335 $file = substr($file, 0, dol_strlen($file) - 4);
336 try {
337 dol_include_once($dirroot.$file.'.php');
338 } catch (Exception $e) {
339 dol_syslog($e->getMessage(), LOG_ERR);
340 continue;
341 }
342 $modCodeMember = new $file();
344 // Show modules according to features level
345 if ($modCodeMember->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
346 continue;
347 }
348 if ($modCodeMember->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
349 continue;
350 }
351
352 $arrayofmodules[$file] = $modCodeMember;
353 }
354 }
355 closedir($handle);
356 }
357}
358
359$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
360'@phan-var-force array<string,ModeleNumRefMembers> $arrayofmodules';
363foreach ($arrayofmodules as $file => $modCodeMember) {
364 print '<tr class="oddeven">'."\n";
365 print '<td width="140">'.$modCodeMember->name.'</td>'."\n";
366 print '<td>'.$modCodeMember->info($langs).'</td>'."\n";
367 print '<td class="nowrap">'.$modCodeMember->getExample().'</td>'."\n";
368
369 if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON', 'mod_member_simple') == "$file") {
370 print '<td class="center">'."\n";
371 print img_picto($langs->trans("Activated"), 'switch_on');
372 print "</td>\n";
373 } else {
374 $isshareonotherentity = (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity); // @phpstan-ignore-line
375 $disabled = (isModEnabled('multicompany') && $isshareonotherentity);
376 print '<td class="center">';
377 if (!$disabled) {
378 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodemember&token='.newToken().'&value='.urlencode($file).'">';
379 }
380 print img_picto($langs->trans("Disabled"), 'switch_off');
381 if (!$disabled) {
382 print '</a>';
383 }
384 print '</td>';
385 }
386
387 print '<td class="center">';
388 $s = $modCodeMember->getToolTip($langs, null);
389 print $form->textwithpicto('', $s, 1);
390 print '</td>';
391
392 print '</tr>';
393}
394print '</table>';
395print '</div>';
396
397
398
399print "<br>";
400
401
402
403// Document templates for documents generated from member record
404
405$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
406
407
408// Defined model definition table
409$def = array();
410// TODO Replace with $def = getListOfModels($db, $type);
411$sql = "SELECT nom as name";
412$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
413$sql .= " WHERE type = '".$db->escape($type)."'";
414$sql .= " AND entity = ".((int) $conf->entity);
415$resql = $db->query($sql);
416if ($resql) {
417 $i = 0;
418 $num_rows = $db->num_rows($resql);
419 while ($i < $num_rows) {
420 $obj = $db->fetch_object($resql);
421 array_push($def, $obj->name);
422 $i++;
423 }
424} else {
426}
427
428
429print load_fiche_titre($langs->trans("MembersDocModules"), '', '');
430
431print '<div class="div-table-responsive-no-min">';
432print '<table class="noborder centpercent">';
433print '<tr class="liste_titre">';
434print '<td>'.$langs->trans("Name").'</td>';
435print '<td>'.$langs->trans("Description").'</td>';
436print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
437print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
438print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
439print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
440print "</tr>\n";
441
442clearstatcache();
443
444foreach ($dirmodels as $reldir) {
445 foreach (array('', '/doc') as $valdir) {
446 $dir = dol_buildpath($reldir."core/modules/member".$valdir);
447 if (is_dir($dir)) {
448 $handle = opendir($dir);
449 if (is_resource($handle)) {
450 $filelist = array();
451 while (($file = readdir($handle)) !== false) {
452 $filelist[] = $file;
453 }
454 closedir($handle);
455 arsort($filelist);
456 foreach ($filelist as $file) {
457 if (preg_match('/\.class\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
458 if (file_exists($dir.'/'.$file)) {
459 $name = substr($file, 4, dol_strlen($file) - 14);
460 $classname = substr($file, 0, dol_strlen($file) - 10);
461
462 require_once $dir.'/'.$file;
463 $module = new $classname($db);
464 '@phan-var-force doc_generic_member_odt|pdf_standard_member $module';
467 $modulequalified = 1;
468 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
469 $modulequalified = 0;
470 }
471 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
472 $modulequalified = 0;
473 }
474
475 if ($modulequalified) {
476 print '<tr class="oddeven"><td width="100">';
477 print(empty($module->name) ? $name : $module->name);
478 print "</td><td>\n";
479 if (method_exists($module, 'info')) {
480 print $module->info($langs);
481 } else {
482 print $module->description;
483 }
484 print '</td>';
485
486 // Active
487 if (in_array($name, $def)) {
488 print '<td class="center">'."\n";
489 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del_default&token='.newToken().'&value='.$name.'">';
490 print img_picto($langs->trans("Enabled"), 'switch_on');
491 print '</a>';
492 print '</td>';
493 } else {
494 print '<td class="center">'."\n";
495 print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
496 print "</td>";
497 }
498
499 // Default
500 print '<td class="center">';
501 if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == $name) {
502 print img_picto($langs->trans("Default"), 'on');
503 } else {
504 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
505 }
506 print '</td>';
507
508 // Info
509 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
510 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
511 if ($module->type == 'pdf') {
512 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
513 }
514 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
515 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
516 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
517
518
519 print '<td class="center">';
520 print $form->textwithpicto('', $htmltooltip, 1, 'info');
521 print '</td>';
522
523 // Preview
524 print '<td class="center">';
525 if ($module->type == 'pdf') {
526 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
527 } else {
528 print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
529 }
530 print '</td>';
531
532 print "</tr>\n";
533 }
534 }
535 }
536 }
537 }
538 }
539 }
540}
541
542print '</table>';
543print '</div>';
544
545
546print '<br>';
547
548
549print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
550print '<input type="hidden" name="token" value="'.newToken().'">';
551print '<input type="hidden" name="action" value="updatemainoptions">';
552print '<input type="hidden" name="page_y" value="">';
553
554
555// Main options
556
557print load_fiche_titre($langs->trans("MemberMainOptions"), '', '');
558
559print '<div class="div-table-responsive-no-min">';
560print '<table class="noborder centpercent">';
561print '<tr class="liste_titre">';
562print '<td>'.$langs->trans("Description").'</td>';
563print '<td class="soixantepercent">'.$langs->trans("Value").'</td>';
564print "</tr>\n";
565
566// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.)
567print '<tr class="oddeven drag" id="startfirstdayof"><td>';
568print $form->textwithpicto($langs->trans("MemberSubscriptionStartAfter"), $langs->trans("MemberSubscriptionStartAfterDesc").'<br>'.$langs->trans("MemberSubscriptionStartAfterDesc2"));
569print '</td><td>';
570print '<input type="text" class="right width50" id="MEMBER_SUBSCRIPTION_START_AFTER" name="MEMBER_SUBSCRIPTION_START_AFTER" value="'.getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER').'">';
571print "</td></tr>\n";
572
573// Start date of new membership
574$startpoint = array();
575$startpoint[0] = $langs->trans("NoCorrection");
576$startpoint["m"] = $langs->trans("Month");
577$startpoint["3m"] = $langs->trans("Quarter");
578$startpoint["Y"] = $langs->trans("Year");
579print '<tr class="oddeven drag" id="startfirstdayof"><td>';
580print $langs->trans("MemberSubscriptionStartFirstDayOf");
581print '</td><td>';
582$startfirstdayof = !getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') ? 0 : getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF');
583print $form->selectarray("MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF", $startpoint, $startfirstdayof, 0);
584print "</td></tr>\n";
585
586// Mail required for members
587print '<tr class="oddeven"><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
588print $form->selectyesno('ADHERENT_MAIL_REQUIRED', getDolGlobalInt('ADHERENT_MAIL_REQUIRED'), 1, false, 0, 1);
589print "</td></tr>\n";
590
591// Login/Pass required for members
592print '<tr class="oddeven"><td>';
593print $form->textwithpicto($langs->trans("AdherentLoginRequired"), $langs->trans("AdherentLoginRequiredDesc"));
594print '</td><td>';
595print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED') ? 0 : 1), 1, false, 0, 1);
596print "</td></tr>\n";
597
598// Create an external user login after an online payment of a membership subscription
599// TODO Move this into a checkbox into the validate process of the memberinstead of a global option.
600print '<tr class="oddeven"><td>'.$langs->trans("MemberCreateAnExternalUserForSubscriptionValidated").'</td><td>';
601print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', getDolGlobalInt('ADHERENT_CREATE_EXTERNAL_USER_LOGIN'), 1, false, 0, 1);
602print "</td></tr>\n";
603
604// Send mail information is on by default
605print '<tr class="oddeven"><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>';
606print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', getDolGlobalInt('ADHERENT_DEFAULT_SENDINFOBYMAIL'), 1, false, 0, 1);
607print "</td></tr>\n";
608
609// Publish member information on public annuary
610/* Feature disabled by default for security purpose.
611 $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : '');
612 print '<tr class="oddeven"><td>'.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).'</td><td>';
613 print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED'), 1, false, 0, 1);
614 print "</td></tr>\n";
615*/
616
617// Allow members to change type on renewal forms
618/* To test during next beta
619print '<tr class="oddeven"><td>'.$langs->trans("MemberAllowchangeOfType").'</td><td>';
620print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (getDolGlobalInt('MEMBER_ALLOW_CHANGE_OF_TYPE') ? 0 : 1), 1);
621print "</td></tr>\n";
622*/
623
624// Insert subscription into bank account
625print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>';
626$arraychoices = array('0' => $langs->trans("None"));
627if (isModEnabled("bank")) {
628 $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
629}
630if (isModEnabled("bank") && isModEnabled("societe") && isModEnabled('invoice')) {
631 $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
632}
633if (isModEnabled("bank") && isModEnabled("societe") && isModEnabled('invoice')) {
634 $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
635}
636print '<td>';
637print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
638if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
639 print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
640}
641print '</td>';
642print "</tr>\n";
643
644// Use vat for invoice creation
645if (isModEnabled('invoice')) {
646 print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
647 if (isModEnabled("bank")) {
648 print '<td>';
649 print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0' => $langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry' => $langs->trans("Default")), getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS', '0'), 0);
650 print '</td>';
651 } else {
652 print '<td class="right">';
653 print $langs->trans("WarningModuleNotActive", $langs->transnoentities("Module85Name"));
654 print '</td>';
655 }
656 print "</tr>\n";
657
658 if (isModEnabled("product") || isModEnabled("service")) {
659 print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
660 print '<td>';
661 $selected = getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS');
662 print img_picto('', 'product', 'class="pictofixedwidth"');
663 $form->select_produits((int) $selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0, 0, 1, 2, '', 0, [], 0, 1, 0, 'minwidth100 maxwidth500 widthcentpercentminusx');
664 print '</td>';
665 }
666 print "</tr>\n";
667}
668
669print '</table>';
670print '</div>';
671
672print '<div class="center">';
673print '<input type="submit" class="button reposition" value="'.$langs->trans("Update").'" name="Button">';
674print '</div>';
675
676print '</form>';
677
678
679print '<br>';
680
681
682
683// Generation of cards for members
684
685print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
686print '<input type="hidden" name="token" value="'.newToken().'">';
687print '<input type="hidden" name="action" value="updatememberscards">';
688print '<input type="hidden" name="page_y" value="">';
689
690print load_fiche_titre($langs->trans("MembersCards"), '', '');
691
692$helptext = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
693// Set list of substitution variables (must be the same list than into the core/modules/member/doc/pdf_standard_member.class.php
694$helptext .= '<small>';
695
696$now = dol_now();
697$year = dol_print_date($now, '%Y');
698$month = dol_print_date($now, '%m');
699$day = dol_print_date($now, '%d');
700
701// List of values to scan for a replacement (Must be samevalues than into adherents/cartes/carte.php and pdf_standard_members.class.php)
702$substitutionarray = array(
703 '__MEMBER_ID__' => 'MemberID',
704 '__MEMBER_REF__' => 'MemberRef',
705 '__MEMBER_LOGIN__' => 'MemberLogin',
706 '__MEMBER_TITLE__' => 'MemberLogin',
707 '__MEMBER_FIRSTNAME__' => 'MemberFirstname',
708 '__MEMBER_LASTNAME__' => 'MemberLastname',
709 '__MEMBER_FULLNAME__' => 'MemberFullname',
710 '__MEMBER_COMPANY__' => 'Company',
711 '__MEMBER_ADDRESS__' => 'MemberAddress',
712 '__MEMBER_ZIP__' => 'MemberZip',
713 '__MEMBER_TOWN__' => 'MemberTown',
714 '__MEMBER_COUNTRY__' => 'MemberCountry',
715 '__MEMBER_COUNTRY_CODE__' =>'MemberCountryCode',
716 '__MEMBER_EMAIL__' => 'MemberEmail',
717 '__MEMBER_BIRTH__' => 'MemberBirthdate',
718 '__MEMBER_TYPE__' => 'MemberType',
719 '__MEMBER_PHOTO__' => 'MemberPhoto',
720 '__YEAR__' => $year,
721 '__MONTH__' => $month,
722 '__DAY__' => $day,
723 '__DOL_MAIN_URL_ROOT__' => (string) DOL_MAIN_URL_ROOT,
724 '__SERVER__' => "https://".$_SERVER["SERVER_NAME"]."/"
725);
726foreach ($substitutionarray as $key => $val) {
727 $helptext .= $key.' => '.$val.'<br>';
728}
729// Make substitutions for new variables
730/*
731$array_member = $this->getSubstitutionarrayMember($object, $outputlangs);
732$array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
733$array_other = $this->get_substitutionarray_other($outputlangs);
734
735$substitutionarray = array_merge($substitutionarray, $array_member, $array_soc, $array_other);
736*/
737$helptext .= '</small>';
738
739print '<div class="div-table-responsive-no-min">';
740print '<table class="noborder centpercent">';
741print '<tr class="liste_titre">';
742print '<td>'.$langs->trans("Description").'</td>';
743print '<td class="soixantepercent">'.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'</td>';
744print "</tr>\n";
745
746// Format of cards page
747print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TYPE").'</td><td>';
748
749require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
750$arrayoflabels = array();
751foreach (array_keys($_Avery_Labels) as $codecards) {
752 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
753}
754print $form->selectarray('ADHERENT_CARD_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_CARD_TYPE', 'CARD'), 1, 0, 0);
755
756print "</td></tr>\n";
757
758// Text printed on top of member cards
759print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_HEADER_TEXT").'</td><td>';
760print '<input type="text" class="flat minwidth300" name="ADHERENT_CARD_HEADER_TEXT" value="'.dol_escape_htmltag(getDolGlobalString('ADHERENT_CARD_HEADER_TEXT')).'" spellcheck="false">';
761print "</td></tr>\n";
762
763// Text printed on member cards (align on left)
764print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TEXT").'</td><td>';
765print '<textarea class="flat" name="ADHERENT_CARD_TEXT" cols="50" rows="5" wrap="soft" spellcheck="false">'."\n";
766print getDolGlobalString('ADHERENT_CARD_TEXT');
767print '</textarea>';
768print "</td></tr>\n";
769
770// Text printed on member cards (align on right)
771print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TEXT_RIGHT").'</td><td>';
772print '<textarea class="flat" name="ADHERENT_CARD_TEXT_RIGHT" cols="50" rows="5" wrap="soft" spellcheck="false">'."\n";
773print getDolGlobalString('ADHERENT_CARD_TEXT_RIGHT');
774print '</textarea>';
775print "</td></tr>\n";
776
777// Text printed on bottom of member cards
778print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_FOOTER_TEXT").'</td><td>';
779print '<input type="text" class="flat minwidth300" name="ADHERENT_CARD_FOOTER_TEXT" value="'.dol_escape_htmltag(getDolGlobalString('ADHERENT_CARD_FOOTER_TEXT')).'" spellcheck="false">';
780print "</td></tr>\n";
781
782print '</table>';
783print '</div>';
784
785print '<div class="center">';
786print '<input type="submit" class="button reposition" value="'.$langs->trans("Update").'" name="Button">';
787print '</div>';
788
789print '</form>';
790
791print '<br>';
792
793
794// Membership address sheet
795
796print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
797print '<input type="hidden" name="token" value="'.newToken().'">';
798print '<input type="hidden" name="action" value="updatememberstickets">';
799print '<input type="hidden" name="page_y" value="">';
800
801print load_fiche_titre($langs->trans("MembersTickets"), '', '');
802
803print '<div class="div-table-responsive-no-min">';
804print '<table class="noborder centpercent">';
805print '<tr class="liste_titre">';
806print '<td>'.$langs->trans("Description").'</td>';
807print '<td class="soixantepercent">'.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'</td>';
808print "</tr>\n";
809
810// Format of labels page
811print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_ETIQUETTE_TYPE").'</td><td>';
812
813require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php)
814$arrayoflabels = array();
815foreach (array_keys($_Avery_Labels) as $codecards) {
816 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
817}
818print $form->selectarray('ADHERENT_ETIQUETTE_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') : 'CARD', 1, 0, 0);
819
820print "</td></tr>\n";
821
822// Text printed on member address sheets
823print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_ETIQUETTE_TEXT").'</td><td>';
824print '<textarea class="flat" name="ADHERENT_ETIQUETTE_TEXT" cols="50" rows="5" wrap="soft" spellcheck="false">'."\n";
825print getDolGlobalString('ADHERENT_ETIQUETTE_TEXT');
826print '</textarea>';
827print "</td></tr>\n";
828
829print '</table>';
830print '</div>';
831
832print '<div class="center">';
833print '<input type="submit" class="button reposition" value="'.$langs->trans("Update").'" name="Button">';
834print '</div>';
835
836print '</form>';
837
838print '<br>';
839
840print "<br>";
841
842print dol_get_fiche_end();
843
844// End of page
845llxFooter();
846$db->close();
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage members of a foundation.
Class to manage generation of HTML components Only common components must be here.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
member_admin_prepare_head()
Return array head with list of tabs to view object information.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:133
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.