diff --git a/htdocs/admin/website_options.php b/htdocs/admin/website_options.php index 0a749741152..0d35e4c1daf 100644 --- a/htdocs/admin/website_options.php +++ b/htdocs/admin/website_options.php @@ -1,9 +1,9 @@ * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, @@ -39,14 +39,6 @@ $action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view'; $confirm = GETPOST('confirm', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); -$rowid = GETPOST('rowid', 'alpha'); - -if (!$user->admin) { - accessforbidden(); -} - -$status = 1; - // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -64,6 +56,30 @@ $hookmanager->initHooks(array('admin')); $arrayofparameters = array('WEBSITE_USE_WEBSITE_ACCOUNTS'=>array('css'=>'minwidth200')); +$status = 1; +$rowid = GETPOST('rowid', 'alpha'); + +if (!$user->admin || !isModEnabled('website')) { + accessforbidden(); +} + +// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only +/* +$useFormSetup = 1; + +if (!class_exists('FormSetup')) { + // For retrocompatibility Dolibarr < 16.0 + if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) { + require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php'; + } else { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; + } +} +$formSetup = new FormSetup($db); + +$item = $formSetup->newItem('NO_PARAM_JUST_TEXT'); +*/ + /* * Actions @@ -102,46 +118,45 @@ $h++; print dol_get_fiche_head($head, 'options', '', -1); -if ($action == 'edit') { - print '
'; - print ''; - print ''; - print ''; - print ''; +print '
'; +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; +print ''; +print ''; +print ''; +print ''."\n"; +print ''; - foreach ($arrayofparameters as $key => $val) { - print ''; - } - print '
'.$langs->trans("Parameter").' '.$langs->trans("Value").'
'; - print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); - print '
'; +// Mail required for users - print '
'; - print ''; - print '
'; +print ''; +print ''; +print $form->textwithpicto($langs->trans('WEBSITE_USE_WEBSITE_ACCOUNTS'), $langs->trans('WEBSITE_USE_WEBSITE_ACCOUNTSTooltip')); +print ''; +print ' '; - print '
'; - print '
'; +print ''; +if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('WEBSITE_USE_WEBSITE_ACCOUNTS'); } else { - print ''; - print ''; - - foreach ($arrayofparameters as $key => $val) { - print ''; + if (empty($conf->global->WEBSITE_USE_WEBSITE_ACCOUNTS)) { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } else { + print ''.img_picto($langs->trans("Enabled"), 'on').''; } +} +print ''; - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); - print ''.getDolGlobalString($key).'
'; +print ''; + +if (empty($conf->use_javascript_ajax)) { print '
'; print ''.$langs->trans("Modify").''; print '
'; } - print dol_get_fiche_end(); // End of page diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index 3955c40a6eb..90bd55e6c2f 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -41,7 +41,7 @@ if ($action == 'update' && is_array($arrayofparameters) && !empty($user->admin)) foreach ($arrayofparameters as $key => $val) { // Modify constant only if key was posted (avoid resetting key to the null value) if (GETPOSTISSET($key)) { - if (preg_match('/category:/', $val['type'])) { + if (!empty($val['type']) && preg_match('/category:/', $val['type'])) { if (GETPOST($key, 'int') == '-1') { $val_const = ''; } else { diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index 88aeff2b93b..53e7cf4b170 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -26,13 +26,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; global $conf, $langs, $user, $db; $langs->loadLangs(array("admin", "other", "modulebuilder")); +$action = GETPOST('action', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + if (!$user->admin || !isModEnabled('modulebuilder')) { accessforbidden(); } -$action = GETPOST('action', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); - /* * Actions diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index b27f77d2ef9..19033dca988 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -93,7 +93,6 @@ if (!class_exists('FormSetup')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; } } - $formSetup = new FormSetup($db);