dolibarr 21.0.0-alpha
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-2021 Frédéric France <frederic.france@netlogic.fr>
12 * Copyright (C) 2023 Waël Almoman <info@almoman.com>
13 * Copyright (C) 2024 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';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
40
41// Load translation files required by the page
42$langs->loadLangs(array("admin", "members"));
43
44if (!$user->admin) {
46}
47
48
49$choices = array('yesno', 'texte', 'chaine');
50
51$value = GETPOST('value', 'alpha');
52$label = GETPOST('label', 'alpha');
53$scandir = GETPOST('scandir', 'alpha');
54$type = 'member';
55
56$action = GETPOST('action', 'aZ09');
57$modulepart = GETPOST('modulepart', 'aZ09');
58
59
60/*
61 * Actions
62 */
63
64include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
65
66if ($action == 'set_default') {
67 $ret = addDocumentModel($value, $type, $label, $scandir);
68 $res = true;
69} elseif ($action == 'del_default') {
70 $ret = delDocumentModel($value, $type);
71 if ($ret > 0) {
72 if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == "$value") {
73 dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
74 }
75 }
76 $res = true;
77} elseif ($action == 'setdoc') {
78 // Set default model
79 if (dolibarr_set_const($db, "MEMBER_ADDON_PDF_ODT", $value, 'chaine', 0, '', $conf->entity)) {
80 // The constant that was read ahead of the new set
81 // we therefore go through a variable to have a consistent display
82 $conf->global->MEMBER_ADDON_PDF_ODT = $value;
83 }
84
85 // We activate the model
86 $ret = delDocumentModel($value, $type);
87 if ($ret > 0) {
88 $ret = addDocumentModel($value, $type, $label, $scandir);
89 }
90 $res = true;
91} elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
92 $code = $reg[1];
93 if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
94 header("Location: ".$_SERVER["PHP_SELF"]);
95 exit;
96 } else {
97 dol_print_error($db);
98 }
99} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
100 $code = $reg[1];
101 if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
102 header("Location: ".$_SERVER["PHP_SELF"]);
103 exit;
104 } else {
105 dol_print_error($db);
106 }
107} elseif ($action == 'updatemainoptions') {
108 $db->begin();
109 $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = $res7 = $res8 = $res9 = 0;
110 $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
111 $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
112 $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
113 $res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity);
114 $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
115 $res7 = dolibarr_set_const($db, 'MEMBER_PUBLIC_ENABLED', GETPOST('MEMBER_PUBLIC_ENABLED', 'alpha'), 'chaine', 0, '', $conf->entity);
116 $res8 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', GETPOST('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', 'alpha'), 'chaine', 0, '', $conf->entity);
117 $res9 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_AFTER', GETPOST('MEMBER_SUBSCRIPTION_START_AFTER', 'alpha'), 'chaine', 0, '', $conf->entity);
118 // Use vat for invoice creation
119 if (isModEnabled('invoice')) {
120 $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
121 $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
122 if (isModEnabled("product") || isModEnabled("service")) {
123 $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
124 }
125 }
126 if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0) {
127 setEventMessages('ErrorFailedToSaveData', null, 'errors');
128 $db->rollback();
129 } else {
130 setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
131 $db->commit();
132 }
133} elseif ($action == 'updatememberscards') {
134 $db->begin();
135 $res1 = $res2 = $res3 = $res4 = 0;
136 $res1 = dolibarr_set_const($db, 'ADHERENT_CARD_TYPE', GETPOST('ADHERENT_CARD_TYPE'), 'chaine', 0, '', $conf->entity);
137 $res2 = dolibarr_set_const($db, 'ADHERENT_CARD_HEADER_TEXT', GETPOST('ADHERENT_CARD_HEADER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
138 $res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT', GETPOST('ADHERENT_CARD_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
139 $res3 = dolibarr_set_const($db, 'ADHERENT_CARD_TEXT_RIGHT', GETPOST('ADHERENT_CARD_TEXT_RIGHT', 'alpha'), 'chaine', 0, '', $conf->entity);
140 $res4 = dolibarr_set_const($db, 'ADHERENT_CARD_FOOTER_TEXT', GETPOST('ADHERENT_CARD_FOOTER_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
141
142 if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0) {
143 setEventMessages('ErrorFailedToSaveDate', null, 'errors');
144 $db->rollback();
145 } else {
146 setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
147 $db->commit();
148 }
149} elseif ($action == 'updatememberstickets') {
150 $db->begin();
151 $res1 = $res2 = 0;
152 $res1 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TYPE', GETPOST('ADHERENT_ETIQUETTE_TYPE'), 'chaine', 0, '', $conf->entity);
153 $res2 = dolibarr_set_const($db, 'ADHERENT_ETIQUETTE_TEXT', GETPOST('ADHERENT_ETIQUETTE_TEXT', 'alpha'), 'chaine', 0, '', $conf->entity);
154
155 if ($res1 < 0 || $res2 < 0) {
156 setEventMessages('ErrorFailedToSaveDate', null, 'errors');
157 $db->rollback();
158 } else {
159 setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
160 $db->commit();
161 }
162} elseif ($action == 'setcodemember') {
163 $result = dolibarr_set_const($db, "MEMBER_CODEMEMBER_ADDON", $value, 'chaine', 0, '', $conf->entity);
164 if ($result <= 0) {
165 dol_print_error($db);
166 }
167} elseif ($action == 'update' || $action == 'add') {
168 // Action to update or add a constant
169 $constname = GETPOST('constname', 'alpha');
170 $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
171
172
173 if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) {
174 $constvalue = '';
175 }
176 if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') { // Invert choice
177 if ($constvalue) {
178 $constvalue = 0;
179 } else {
180 $constvalue = 1;
181 }
182 }
183
184 $consttype = GETPOST('consttype', 'alpha');
185 $constnote = GETPOST('constnote');
186 $res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
187
188 if (!($res > 0)) {
189 $error++;
190 }
191
192 if (!$error) {
193 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
194 } else {
195 setEventMessages($langs->trans("Error"), null, 'errors');
196 }
197}
198
199// Action to enable of a submodule of the adherent module
200if ($action == 'set') {
201 $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
202 if ($result < 0) {
203 print $db->error();
204 }
205}
206
207// Action to disable a submodule of the adherent module
208if ($action == 'unset') {
209 $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
210 if ($result < 0) {
211 print $db->error();
212 }
213}
214
215
216
217/*
218 * View
219 */
220
221$form = new Form($db);
222
223$title = $langs->trans("MembersSetup");
224$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
225
226llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-admin');
227
228
229$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
230print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
231
232
234
235print dol_get_fiche_head($head, 'general', $langs->trans("Members"), -1, 'user');
236
237$dirModMember = array_merge(array('/core/modules/member/'), $conf->modules_parts['member']);
238foreach ($conf->modules_parts['models'] as $mo) {
239 //Add more models
240 $dirModMember[] = $mo.'core/modules/member/';
241}
242
243// Module to manage customer/supplier code
244
245print load_fiche_titre($langs->trans("MemberCodeChecker"), '', '');
246
247print '<div class="div-table-responsive-no-min">';
248print '<table class="noborder centpercent">'."\n";
249print '<tr class="liste_titre">'."\n";
250print ' <td>'.$langs->trans("Name").'</td>';
251print ' <td>'.$langs->trans("Description").'</td>';
252print ' <td>'.$langs->trans("Example").'</td>';
253print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
254print ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
255print "</tr>\n";
256
257$arrayofmodules = array();
258
259foreach ($dirModMember as $dirroot) {
260 $dir = dol_buildpath($dirroot, 0);
261
262 $handle = @opendir($dir);
263 if (is_resource($handle)) {
264 // Loop on each module find in opened directory
265 while (($file = readdir($handle)) !== false) {
266 // module filename has to start with mod_member_
267 if (substr($file, 0, 11) == 'mod_member_' && substr($file, -3) == 'php') {
268 $file = substr($file, 0, dol_strlen($file) - 4);
269 try {
270 dol_include_once($dirroot.$file.'.php');
271 } catch (Exception $e) {
272 dol_syslog($e->getMessage(), LOG_ERR);
273 continue;
274 }
275 $modCodeMember = new $file();
276 // Show modules according to features level
277 if ($modCodeMember->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
278 continue;
279 }
280 if ($modCodeMember->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
281 continue;
282 }
283
284 $arrayofmodules[$file] = $modCodeMember;
285 }
286 }
287 closedir($handle);
288 }
289}
290
291$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
292'@phan-var-force array<string,ModeleNumRefMembers> $arrayofmodules';
293
294foreach ($arrayofmodules as $file => $modCodeMember) {
295 print '<tr class="oddeven">'."\n";
296 print '<td width="140">'.$modCodeMember->name.'</td>'."\n";
297 print '<td>'.$modCodeMember->info($langs).'</td>'."\n";
298 print '<td class="nowrap">'.$modCodeMember->getExample($langs).'</td>'."\n";
299
300 if (getDolGlobalString('MEMBER_CODEMEMBER_ADDON') == "$file") {
301 print '<td class="center">'."\n";
302 print img_picto($langs->trans("Activated"), 'switch_on');
303 print "</td>\n";
304 } else {
305 $disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false);
306 print '<td class="center">';
307 if (!$disabled) {
308 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodemember&token='.newToken().'&value='.urlencode($file).'">';
309 }
310 print img_picto($langs->trans("Disabled"), 'switch_off');
311 if (!$disabled) {
312 print '</a>';
313 }
314 print '</td>';
315 }
316
317 print '<td class="center">';
318 $s = $modCodeMember->getToolTip($langs, null, -1);
319 print $form->textwithpicto('', $s, 1);
320 print '</td>';
321
322 print '</tr>';
323}
324print '</table>';
325print '</div>';
326
327
328
329print "<br>";
330
331
332
333// Document templates for documents generated from member record
334
335$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
336
337// Defined model definition table
338$def = array();
339$sql = "SELECT nom as name";
340$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
341$sql .= " WHERE type = '".$db->escape($type)."'";
342$sql .= " AND entity = ".$conf->entity;
343$resql = $db->query($sql);
344if ($resql) {
345 $i = 0;
346 $num_rows = $db->num_rows($resql);
347 while ($i < $num_rows) {
348 $obj = $db->fetch_object($resql);
349 array_push($def, $obj->name);
350 $i++;
351 }
352} else {
353 dol_print_error($db);
354}
355
356
357print load_fiche_titre($langs->trans("MembersDocModules"), '', '');
358
359print '<div class="div-table-responsive-no-min">';
360print '<table class="noborder centpercent">';
361print '<tr class="liste_titre">';
362print '<td>'.$langs->trans("Name").'</td>';
363print '<td>'.$langs->trans("Description").'</td>';
364print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
365print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
366print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
367print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
368print "</tr>\n";
369
370clearstatcache();
371
372foreach ($dirmodels as $reldir) {
373 foreach (array('', '/doc') as $valdir) {
374 $dir = dol_buildpath($reldir."core/modules/member".$valdir);
375 if (is_dir($dir)) {
376 $handle = opendir($dir);
377 if (is_resource($handle)) {
378 $filelist = array();
379 while (($file = readdir($handle)) !== false) {
380 $filelist[] = $file;
381 }
382 closedir($handle);
383 arsort($filelist);
384 foreach ($filelist as $file) {
385 if (preg_match('/\.class\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
386 if (file_exists($dir.'/'.$file)) {
387 $name = substr($file, 4, dol_strlen($file) - 14);
388 $classname = substr($file, 0, dol_strlen($file) - 10);
389
390 require_once $dir.'/'.$file;
391 $module = new $classname($db);
392
393 $modulequalified = 1;
394 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
395 $modulequalified = 0;
396 }
397 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
398 $modulequalified = 0;
399 }
400
401 if ($modulequalified) {
402 print '<tr class="oddeven"><td width="100">';
403 print(empty($module->name) ? $name : $module->name);
404 print "</td><td>\n";
405 if (method_exists($module, 'info')) {
406 print $module->info($langs);
407 } else {
408 print $module->description;
409 }
410 print '</td>';
411
412 // Active
413 if (in_array($name, $def)) {
414 print '<td class="center">'."\n";
415 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del_default&token='.newToken().'&value='.$name.'">';
416 print img_picto($langs->trans("Enabled"), 'switch_on');
417 print '</a>';
418 print '</td>';
419 } else {
420 print '<td class="center">'."\n";
421 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>';
422 print "</td>";
423 }
424
425 // Default
426 print '<td class="center">';
427 if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == $name) {
428 print img_picto($langs->trans("Default"), 'on');
429 } else {
430 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>';
431 }
432 print '</td>';
433
434 // Info
435 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
436 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
437 if ($module->type == 'pdf') {
438 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
439 }
440 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
441 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
442 $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
443
444
445 print '<td class="center">';
446 print $form->textwithpicto('', $htmltooltip, 1, 0);
447 print '</td>';
448
449 // Preview
450 print '<td class="center">';
451 if ($module->type == 'pdf') {
452 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
453 } else {
454 print img_object($langs->trans("PreviewNotAvailable"), 'generic');
455 }
456 print '</td>';
457
458 print "</tr>\n";
459 }
460 }
461 }
462 }
463 }
464 }
465 }
466}
467
468print '</table>';
469print '</div>';
470
471
472print '<br>';
473
474
475print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
476print '<input type="hidden" name="token" value="'.newToken().'">';
477print '<input type="hidden" name="action" value="updatemainoptions">';
478print '<input type="hidden" name="page_y" value="">';
479
480
481// Main options
482
483print load_fiche_titre($langs->trans("MemberMainOptions"), '', '');
484
485print '<div class="div-table-responsive-no-min">';
486print '<table class="noborder centpercent">';
487print '<tr class="liste_titre">';
488print '<td>'.$langs->trans("Description").'</td>';
489print '<td class="soixantepercent">'.$langs->trans("Value").'</td>';
490print "</tr>\n";
491
492// Start date of new membership
493$startpoint = array();
494$startpoint[0] = $langs->trans("SubscriptionPayment");
495$startpoint["m"] = $langs->trans("Month");
496$startpoint["Y"] = $langs->trans("Year");
497print '<tr class="oddeven drag" id="startfirstdayof"><td>';
498print $langs->trans("MemberSubscriptionStartFirstDayOf");
499print '</td><td>';
500$startfirstdayof = !getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') ? 0 : getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF');
501print $form->selectarray("MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF", $startpoint, $startfirstdayof, 0);
502print "</td></tr>\n";
503
504// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.)
505print '<tr class="oddeven drag" id="startfirstdayof"><td>';
506print $langs->trans("MemberSubscriptionStartAfter");
507print '</td><td>';
508print '<input type="text" class="right width50" id="MEMBER_SUBSCRIPTION_START_AFTER" name="MEMBER_SUBSCRIPTION_START_AFTER" value="'.getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER').'">';
509print "</td></tr>\n";
510
511// Mail required for members
512print '<tr class="oddeven"><td>'.$langs->trans("AdherentMailRequired").'</td><td>';
513print $form->selectyesno('ADHERENT_MAIL_REQUIRED', getDolGlobalInt('ADHERENT_MAIL_REQUIRED'), 1, false, 0, 1);
514print "</td></tr>\n";
515
516// Login/Pass required for members
517print '<tr class="oddeven"><td>';
518print $form->textwithpicto($langs->trans("AdherentLoginRequired"), $langs->trans("AdherentLoginRequiredDesc"));
519print '</td><td>';
520print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED') ? 0 : 1), 1, false, 0, 1);
521print "</td></tr>\n";
522
523// Send mail information is on by default
524print '<tr class="oddeven"><td>'.$langs->trans("MemberSendInformationByMailByDefault").'</td><td>';
525print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', getDolGlobalInt('ADHERENT_DEFAULT_SENDINFOBYMAIL'), 1, false, 0, 1);
526print "</td></tr>\n";
527
528// Create an external user login for each new member subscription validated
529print '<tr class="oddeven"><td>'.$langs->trans("MemberCreateAnExternalUserForSubscriptionValidated").'</td><td>';
530print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', getDolGlobalInt('ADHERENT_CREATE_EXTERNAL_USER_LOGIN'), 1, false, 0, 1);
531print "</td></tr>\n";
532
533// Create an external user login for each new member subscription validated
534$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : '');
535print '<tr class="oddeven"><td>'.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).'</td><td>';
536print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED'), 1, false, 0, 1);
537print "</td></tr>\n";
538
539// Allow members to change type on renewal forms
540/* To test during next beta
541print '<tr class="oddeven"><td>'.$langs->trans("MemberAllowchangeOfType").'</td><td>';
542print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (getDolGlobalInt('MEMBER_ALLOW_CHANGE_OF_TYPE') ? 0 : 1), 1);
543print "</td></tr>\n";
544*/
545
546// Insert subscription into bank account
547print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>';
548$arraychoices = array('0' => $langs->trans("None"));
549if (isModEnabled("bank")) {
550 $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
551}
552if (isModEnabled("bank") && isModEnabled("societe") && isModEnabled('invoice')) {
553 $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
554}
555if (isModEnabled("bank") && isModEnabled("societe") && isModEnabled('invoice')) {
556 $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
557}
558print '<td>';
559print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
560if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
561 print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
562}
563print '</td>';
564print "</tr>\n";
565
566// Use vat for invoice creation
567if (isModEnabled('invoice')) {
568 print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
569 if (isModEnabled("bank")) {
570 print '<td>';
571 print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0' => $langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry' => $langs->trans("Default")), getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS', '0'), 0);
572 print '</td>';
573 } else {
574 print '<td class="right">';
575 print $langs->trans("WarningModuleNotActive", $langs->transnoentities("Module85Name"));
576 print '</td>';
577 }
578 print "</tr>\n";
579
580 if (isModEnabled("product") || isModEnabled("service")) {
581 print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
582 print '<td>';
583 $selected = getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS');
584 print img_picto('', 'product', 'class="pictofixedwidth"');
585 $form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0, 0, 1, 2, '', 0, [], 0, 1, 0, 'minwidth100 maxwidth500 widthcentpercentminusx');
586 print '</td>';
587 }
588 print "</tr>\n";
589}
590
591print '</table>';
592print '</div>';
593
594print '<div class="center">';
595print '<input type="submit" class="button reposition" value="'.$langs->trans("Update").'" name="Button">';
596print '</div>';
597
598print '</form>';
599
600
601print '<br>';
602
603
604
605// Generation of cards for members
606
607print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
608print '<input type="hidden" name="token" value="'.newToken().'">';
609print '<input type="hidden" name="action" value="updatememberscards">';
610print '<input type="hidden" name="page_y" value="">';
611
612print load_fiche_titre($langs->trans("MembersCards"), '', '');
613
614$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
615$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
616$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
617$helptext .= '__YEAR__, __MONTH__, __DAY__';
618
619print '<div class="div-table-responsive-no-min">';
620print '<table class="noborder centpercent">';
621print '<tr class="liste_titre">';
622print '<td>'.$langs->trans("Description").'</td>';
623print '<td class="soixantepercent">'.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'</td>';
624print "</tr>\n";
625
626// Format of cards page
627print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TYPE").'</td><td>';
628
629require_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)
630$arrayoflabels = array();
631foreach (array_keys($_Avery_Labels) as $codecards) {
632 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
633}
634print $form->selectarray('ADHERENT_CARD_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_CARD_TYPE') ? getDolGlobalString('ADHERENT_CARD_TYPE') : 'CARD', 1, 0, 0);
635
636print "</td></tr>\n";
637
638// Text printed on top of member cards
639print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_HEADER_TEXT").'</td><td>';
640print '<input type="text" class="flat minwidth300" name="ADHERENT_CARD_HEADER_TEXT" value="'.dol_escape_htmltag(getDolGlobalString('ADHERENT_CARD_HEADER_TEXT')).'">';
641print "</td></tr>\n";
642
643// Text printed on member cards (align on left)
644print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TEXT").'</td><td>';
645print '<textarea class="flat" name="ADHERENT_CARD_TEXT" cols="50" rows="5" wrap="soft">'."\n";
646print getDolGlobalString('ADHERENT_CARD_TEXT');
647print '</textarea>';
648print "</td></tr>\n";
649
650// Text printed on member cards (align on right)
651print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_TEXT_RIGHT").'</td><td>';
652print '<textarea class="flat" name="ADHERENT_CARD_TEXT_RIGHT" cols="50" rows="5" wrap="soft">'."\n";
653print getDolGlobalString('ADHERENT_CARD_TEXT_RIGHT');
654print '</textarea>';
655print "</td></tr>\n";
656
657// Text printed on bottom of member cards
658print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_CARD_FOOTER_TEXT").'</td><td>';
659print '<input type="text" class="flat minwidth300" name="ADHERENT_CARD_FOOTER_TEXT" value="'.dol_escape_htmltag(getDolGlobalString('ADHERENT_CARD_FOOTER_TEXT')).'">';
660print "</td></tr>\n";
661
662print '</table>';
663print '</div>';
664
665print '<div class="center">';
666print '<input type="submit" class="button reposition" value="'.$langs->trans("Update").'" name="Button">';
667print '</div>';
668
669print '</form>';
670
671print '<br>';
672
673
674// Membership address sheet
675
676print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
677print '<input type="hidden" name="token" value="'.newToken().'">';
678print '<input type="hidden" name="action" value="updatememberstickets">';
679print '<input type="hidden" name="page_y" value="">';
680
681print load_fiche_titre($langs->trans("MembersTickets"), '', '');
682
683$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
684$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
685$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
686$helptext .= '__YEAR__, __MONTH__, __DAY__';
687
688print '<div class="div-table-responsive-no-min">';
689print '<table class="noborder centpercent">';
690print '<tr class="liste_titre">';
691print '<td>'.$langs->trans("Description").'</td>';
692print '<td class="soixantepercent">'.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'</td>';
693print "</tr>\n";
694
695// Format of labels page
696print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_ETIQUETTE_TYPE").'</td><td>';
697
698require_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)
699$arrayoflabels = array();
700foreach (array_keys($_Avery_Labels) as $codecards) {
701 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name'];
702}
703print $form->selectarray('ADHERENT_ETIQUETTE_TYPE', $arrayoflabels, getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') ? getDolGlobalString('ADHERENT_ETIQUETTE_TYPE') : 'CARD', 1, 0, 0);
704
705print "</td></tr>\n";
706
707// Text printed on member address sheets
708print '<tr class="oddeven"><td>'.$langs->trans("DescADHERENT_ETIQUETTE_TEXT").'</td><td>';
709print '<textarea class="flat" name="ADHERENT_ETIQUETTE_TEXT" cols="50" rows="5" wrap="soft">'."\n";
710print getDolGlobalString('ADHERENT_ETIQUETTE_TEXT');
711print '</textarea>';
712print "</td></tr>\n";
713
714print '</table>';
715print '</div>';
716
717print '<div class="center">';
718print '<input type="submit" class="button reposition" value="'.$langs->trans("Update").'" name="Button">';
719print '</div>';
720
721print '</form>';
722
723print '<br>';
724
725print "<br>";
726
727print dol_get_fiche_end();
728
729// End of page
730llxFooter();
731$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.
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:70
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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:142
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.