34 require
'../../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
39 $langs->loadLangs(array(
"admin",
"members"));
46 $choices = array(
'yesno',
'texte',
'chaine');
48 $value =
GETPOST(
'value',
'alpha');
49 $label =
GETPOST(
'label',
'alpha');
50 $scandir =
GETPOST(
'scandir',
'alpha');
53 $action =
GETPOST(
'action',
'aZ09');
60 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
62 if ($action ==
'set_default') {
65 } elseif ($action ==
'del_default') {
73 } elseif ($action ==
'setdoc') {
75 if (
dolibarr_set_const($db,
"MEMBER_ADDON_PDF_ODT", $value,
'chaine', 0,
'', $conf->entity)) {
78 $conf->global->MEMBER_ADDON_PDF_ODT = $value;
87 } elseif (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
90 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
95 } elseif (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
98 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
103 } elseif ($action ==
'updatemainoptions') {
105 $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = $res7 = 0;
106 $res1 =
dolibarr_set_const($db,
'ADHERENT_LOGIN_NOT_REQUIRED',
GETPOST(
'ADHERENT_LOGIN_NOT_REQUIRED',
'alpha') ? 0 : 1,
'chaine', 0,
'', $conf->entity);
107 $res2 =
dolibarr_set_const($db,
'ADHERENT_MAIL_REQUIRED',
GETPOST(
'ADHERENT_MAIL_REQUIRED',
'alpha'),
'chaine', 0,
'', $conf->entity);
108 $res3 =
dolibarr_set_const($db,
'ADHERENT_DEFAULT_SENDINFOBYMAIL',
GETPOST(
'ADHERENT_DEFAULT_SENDINFOBYMAIL',
'alpha'),
'chaine', 0,
'', $conf->entity);
109 $res3 =
dolibarr_set_const($db,
'ADHERENT_CREATE_EXTERNAL_USER_LOGIN',
GETPOST(
'ADHERENT_CREATE_EXTERNAL_USER_LOGIN',
'alpha'),
'chaine', 0,
'', $conf->entity);
110 $res4 =
dolibarr_set_const($db,
'ADHERENT_BANK_USE',
GETPOST(
'ADHERENT_BANK_USE',
'alpha'),
'chaine', 0,
'', $conf->entity);
113 $res4 =
dolibarr_set_const($db,
'ADHERENT_VAT_FOR_SUBSCRIPTIONS',
GETPOST(
'ADHERENT_VAT_FOR_SUBSCRIPTIONS',
'alpha'),
'chaine', 0,
'', $conf->entity);
114 $res5 =
dolibarr_set_const($db,
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
GETPOST(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
'alpha'),
'chaine', 0,
'', $conf->entity);
116 $res6 =
dolibarr_set_const($db,
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
GETPOST(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
'alpha'),
'chaine', 0,
'', $conf->entity);
119 if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
126 } elseif ($action ==
'updatememberscards') {
128 $res1 = $res2 = $res3 = $res4 = 0;
130 $res2 =
dolibarr_set_const($db,
'ADHERENT_CARD_HEADER_TEXT',
GETPOST(
'ADHERENT_CARD_HEADER_TEXT',
'alpha'),
'chaine', 0,
'', $conf->entity);
131 $res3 =
dolibarr_set_const($db,
'ADHERENT_CARD_TEXT',
GETPOST(
'ADHERENT_CARD_TEXT',
'alpha'),
'chaine', 0,
'', $conf->entity);
132 $res3 =
dolibarr_set_const($db,
'ADHERENT_CARD_TEXT_RIGHT',
GETPOST(
'ADHERENT_CARD_TEXT_RIGHT',
'alpha'),
'chaine', 0,
'', $conf->entity);
133 $res4 =
dolibarr_set_const($db,
'ADHERENT_CARD_FOOTER_TEXT',
GETPOST(
'ADHERENT_CARD_FOOTER_TEXT',
'alpha'),
'chaine', 0,
'', $conf->entity);
135 if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0) {
142 } elseif ($action ==
'updatememberstickets') {
145 $res1 =
dolibarr_set_const($db,
'ADHERENT_ETIQUETTE_TYPE',
GETPOST(
'ADHERENT_ETIQUETTE_TYPE'),
'chaine', 0,
'', $conf->entity);
146 $res2 =
dolibarr_set_const($db,
'ADHERENT_ETIQUETTE_TEXT',
GETPOST(
'ADHERENT_ETIQUETTE_TEXT',
'alpha'),
'chaine', 0,
'', $conf->entity);
148 if ($res1 < 0 || $res2 < 0) {
158 if ($action ==
'update' || $action ==
'add') {
159 $constname =
GETPOST(
'constname',
'alpha');
160 $constvalue = (
GETPOST(
'constvalue_'.$constname) ?
GETPOST(
'constvalue_'.$constname) :
GETPOST(
'constvalue'));
163 if (($constname ==
'ADHERENT_CARD_TYPE' || $constname ==
'ADHERENT_ETIQUETTE_TYPE' || $constname ==
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) {
166 if ($constname ==
'ADHERENT_LOGIN_NOT_REQUIRED') {
174 $consttype =
GETPOST(
'consttype',
'alpha');
175 $constnote =
GETPOST(
'constnote');
176 $res =
dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
190 if ($action ==
'set') {
198 if ($action ==
'unset') {
213 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
218 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
219 print
load_fiche_titre($langs->trans(
"MembersSetup"), $linkback,
'title_setup');
226 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
227 print
'<input type="hidden" name="token" value="'.newToken().
'">';
228 print
'<input type="hidden" name="action" value="updatemainoptions">';
235 print
'<div class="div-table-responsive-no-min">';
236 print
'<table class="noborder centpercent">';
237 print
'<tr class="liste_titre">';
238 print
'<td>'.$langs->trans(
"Description").
'</td>';
239 print
'<td>'.$langs->trans(
"Value").
'</td>';
243 print
'<tr class="oddeven"><td>'.$langs->trans(
"AdherentMailRequired").
'</td><td>';
244 print
$form->selectyesno(
'ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1);
245 print
"</td></tr>\n";
248 print
'<tr class="oddeven"><td>'.$langs->trans(
"AdherentLoginRequired").
'</td><td>';
249 print
$form->selectyesno(
'ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1);
250 print
"</td></tr>\n";
253 print
'<tr class="oddeven"><td>'.$langs->trans(
"MemberSendInformationByMailByDefault").
'</td><td>';
254 print
$form->selectyesno(
'ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);
255 print
"</td></tr>\n";
258 print
'<tr class="oddeven"><td>'.$langs->trans(
"MemberCreateAnExternalUserForSubscriptionValidated").
'</td><td>';
259 print
$form->selectyesno(
'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', (!empty($conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN) ? $conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN : 0), 1);
260 print
"</td></tr>\n";
270 print
'<tr class="oddeven"><td>'.$langs->trans(
"MoreActionsOnSubscription").
'</td>';
271 $arraychoices = array(
'0'=>$langs->trans(
"None"));
273 $arraychoices[
'bankdirect'] = $langs->trans(
"MoreActionBankDirect");
276 $arraychoices[
'invoiceonly'] = $langs->trans(
"MoreActionInvoiceOnly");
279 $arraychoices[
'bankviainvoice'] = $langs->trans(
"MoreActionBankViaInvoice");
284 print
'<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans(
"ABankAccountMustBeDefinedOnPaymentModeSetup").
'</span></div>';
291 print
'<tr class="oddeven"><td>'.$langs->trans(
"VATToUseForSubscriptions").
'</td>';
294 print
$form->selectarray(
'ADHERENT_VAT_FOR_SUBSCRIPTIONS', array(
'0'=>$langs->trans(
"NoVatOnSubscription"),
'defaultforfoundationcountry'=>$langs->trans(
"Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ?
'0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
297 print
'<td class="right">';
298 print $langs->trans(
"WarningModuleNotActive", $langs->transnoentities(
"Module85Name"));
304 print
'<tr class="oddeven"><td>'.$langs->trans(
"ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").
'</td>';
306 $selected = (empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) ?
'' : $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
307 print
img_picto(
'',
'product',
'class="pictofixedwidth"');
308 $form->select_produits($selected,
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
'', 0);
317 print
'<div class="center">';
318 print
'<input type="submit" class="button" value="'.$langs->trans(
"Update").
'" name="Button">';
329 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
333 $sql =
"SELECT nom as name";
334 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
335 $sql .=
" WHERE type = '".$db->escape($type).
"'";
336 $sql .=
" AND entity = ".$conf->entity;
337 $resql = $db->query($sql);
340 $num_rows = $db->num_rows(
$resql);
341 while ($i < $num_rows) {
342 $obj = $db->fetch_object(
$resql);
343 array_push($def, $obj->name);
353 print
'<div class="div-table-responsive-no-min">';
354 print
'<table class="noborder centpercent">';
355 print
'<tr class="liste_titre">';
356 print
'<td>'.$langs->trans(
"Name").
'</td>';
357 print
'<td>'.$langs->trans(
"Description").
'</td>';
358 print
'<td align="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
359 print
'<td align="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
360 print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
361 print
'<td align="center" width="80">'.$langs->trans(
"Preview").
'</td>';
366 foreach ($dirmodels as $reldir) {
367 foreach (array(
'',
'/doc') as $valdir) {
370 $handle = opendir($dir);
371 if (is_resource($handle)) {
372 while (($file = readdir($handle)) !==
false) {
377 foreach ($filelist as $file) {
378 if (preg_match(
'/\.class\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
379 if (file_exists($dir.
'/'.$file)) {
380 $name = substr($file, 4,
dol_strlen($file) - 14);
381 $classname = substr($file, 0,
dol_strlen($file) - 10);
383 require_once $dir.
'/'.$file;
384 $module =
new $classname($db);
386 $modulequalified = 1;
387 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
388 $modulequalified = 0;
390 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
391 $modulequalified = 0;
394 if ($modulequalified) {
395 print
'<tr class="oddeven"><td width="100">';
396 print (empty($module->name) ? $name : $module->name);
398 if (method_exists($module,
'info')) {
399 print $module->info($langs);
401 print $module->description;
406 if (in_array($name, $def)) {
407 print
'<td class="center">'.
"\n";
408 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del_default&token='.
newToken().
'&value='.$name.
'">';
409 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
413 print
'<td class="center">'.
"\n";
414 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>';
419 print
'<td class="center">';
421 print
img_picto($langs->trans(
"Default"),
'on');
423 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>';
428 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
429 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
430 if ($module->type ==
'pdf') {
431 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
433 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
434 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
435 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
438 print
'<td class="center">';
439 print
$form->textwithpicto(
'', $htmltooltip, 1, 0);
443 print
'<td class="center">';
444 if ($module->type ==
'pdf') {
445 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'contract').
'</a>';
447 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
469 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
470 print
'<input type="hidden" name="token" value="'.newToken().
'">';
471 print
'<input type="hidden" name="action" value="updatememberscards">';
475 $helptext =
'*'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
'<br>';
476 $helptext .=
'__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
477 $helptext .=
'__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
478 $helptext .=
'__YEAR__, __MONTH__, __DAY__';
480 print
'<div class="div-table-responsive-no-min">';
481 print
'<table class="noborder centpercent">';
482 print
'<tr class="liste_titre">';
483 print
'<td>'.$langs->trans(
"Description").
'</td>';
484 print
'<td>'.$form->textwithpicto($langs->trans(
"Value"), $helptext, 1,
'help',
'', 0, 2,
'idhelptext').
'</td>';
488 print
'<tr class="oddeven"><td>'.$langs->trans(
"DescADHERENT_CARD_TYPE").
'</td><td>';
490 require_once DOL_DOCUMENT_ROOT.
'/core/lib/format_cards.lib.php';
491 $arrayoflabels = array();
492 foreach (array_keys($_Avery_Labels) as $codecards) {
493 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards][
'name'];
497 print
"</td></tr>\n";
500 print
'<tr class="oddeven"><td>'.$langs->trans(
"DescADHERENT_CARD_HEADER_TEXT").
'</td><td>';
501 print
'<input type="text" class="flat minwidth300" name="ADHERENT_CARD_HEADER_TEXT" value="'.dol_escape_htmltag(
getDolGlobalString(
'ADHERENT_CARD_HEADER_TEXT')).
'">';
502 print
"</td></tr>\n";
505 print
'<tr class="oddeven"><td>'.$langs->trans(
"DescADHERENT_CARD_TEXT").
'</td><td>';
506 print
'<textarea class="flat" name="ADHERENT_CARD_TEXT" cols="50" rows="5" wrap="soft">'.
"\n";
509 print
"</td></tr>\n";
512 print
'<tr class="oddeven"><td>'.$langs->trans(
"DescADHERENT_CARD_TEXT_RIGHT").
'</td><td>';
513 print
'<textarea class="flat" name="ADHERENT_CARD_TEXT_RIGHT" cols="50" rows="5" wrap="soft">'.
"\n";
516 print
"</td></tr>\n";
519 print
'<tr class="oddeven"><td>'.$langs->trans(
"DescADHERENT_CARD_FOOTER_TEXT").
'</td><td>';
520 print
'<input type="text" class="flat minwidth300" name="ADHERENT_CARD_FOOTER_TEXT" value="'.dol_escape_htmltag(
getDolGlobalString(
'ADHERENT_CARD_FOOTER_TEXT')).
'">';
521 print
"</td></tr>\n";
526 print
'<div class="center">';
527 print
'<input type="submit" class="button" value="'.$langs->trans(
"Update").
'" name="Button">';
536 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
537 print
'<input type="hidden" name="token" value="'.newToken().
'">';
538 print
'<input type="hidden" name="action" value="updatememberstickets">';
542 $helptext =
'*'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
'<br>';
543 $helptext .=
'__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
544 $helptext .=
'__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
545 $helptext .=
'__YEAR__, __MONTH__, __DAY__';
547 print
'<div class="div-table-responsive-no-min">';
548 print
'<table class="noborder centpercent">';
549 print
'<tr class="liste_titre">';
550 print
'<td>'.$langs->trans(
"Description").
'</td>';
551 print
'<td>'.$form->textwithpicto($langs->trans(
"Value"), $helptext, 1,
'help',
'', 0, 2,
'idhelptext').
'</td>';
555 print
'<tr class="oddeven"><td>'.$langs->trans(
"DescADHERENT_ETIQUETTE_TYPE").
'</td><td>';
557 require_once DOL_DOCUMENT_ROOT.
'/core/lib/format_cards.lib.php';
558 $arrayoflabels = array();
559 foreach (array_keys($_Avery_Labels) as $codecards) {
560 $arrayoflabels[$codecards] = $_Avery_Labels[$codecards][
'name'];
564 print
"</td></tr>\n";
567 print
'<tr class="oddeven"><td>'.$langs->trans(
"DescADHERENT_ETIQUETTE_TEXT").
'</td><td>';
568 print
'<textarea class="flat" name="ADHERENT_ETIQUETTE_TEXT" cols="50" rows="5" wrap="soft">'.
"\n";
571 print
"</td></tr>\n";
576 print
'<div class="center">';
577 print
'<input type="submit" class="button" value="'.$langs->trans(
"Update").
'" name="Button">';