diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php
index c7cc61171a7..0db6b9b7648 100644
--- a/htdocs/modulebuilder/template/admin/setup.php
+++ b/htdocs/modulebuilder/template/admin/setup.php
@@ -47,7 +47,9 @@ require_once '../lib/mymodule.lib.php';
$langs->loadLangs(array("admin", "mymodule@mymodule"));
// Access control
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
// Parameters
$action = GETPOST('action', 'aZ09');
@@ -71,28 +73,28 @@ $setupnotempty = 0;
* Actions
*/
-if ((float) DOL_VERSION >= 6)
-{
+if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
-if ($action == 'updateMask')
-{
+if ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstorder', 'alpha');
$maskorder = GETPOST('maskorder', 'alpha');
- if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
+ if ($maskconstorder) {
+ $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
+ }
- if (!$res > 0) $error++;
+ if (!$res > 0) {
+ $error++;
+ }
- if (!$error)
- {
+ if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
-} elseif ($action == 'specimen')
-{
+} elseif ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object');
@@ -102,25 +104,21 @@ if ($action == 'updateMask')
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
- foreach ($dirmodels as $reldir)
- {
+ foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
- if (file_exists($file))
- {
+ if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
- if ($filefound)
- {
+ if ($filefound) {
require_once $file;
$module = new $classname($db);
- if ($module->write_file($tmpobject, $langs) > 0)
- {
+ if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
@@ -131,19 +129,15 @@ if ($action == 'updateMask')
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
-}
-
-elseif ($action == 'setmod') {
+} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
}
-}
-
-// Activate a model
-elseif ($action == 'set') {
+} elseif ($action == 'set') {
+ // Activate a model
$ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
@@ -154,10 +148,8 @@ elseif ($action == 'set') {
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
}
}
-}
-
-// Set or unset default model
-elseif ($action == 'setdoc') {
+} elseif ($action == 'setdoc') {
+ // Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
@@ -207,8 +199,7 @@ print dol_get_fiche_head($head, 'settings', '', -1, "mymodule@mymodule");
echo ''.$langs->trans("MyModuleSetupPage").'
';
-if ($action == 'edit')
-{
+if ($action == 'edit') {
print '