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