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