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