From a4cd96e03c25353766a60280ab684b2c41606661 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Sep 2018 10:08:57 +0200 Subject: [PATCH] Clean code when there is no setup to do --- htdocs/modulebuilder/template/admin/setup.php | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 2cc6468729c..6e0be4d0011 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -85,7 +85,7 @@ $head = mymoduleAdminPrepareHead(); dol_fiche_head($head, 'settings', '', -1, "mymodule@mymodule"); // Setup page goes here -echo $langs->trans("MyModuleSetupPage"); +echo $langs->trans("MyModuleSetupPage").'

'; if ($action == 'edit') @@ -99,13 +99,10 @@ if ($action == 'edit') foreach($arrayofparameters as $key => $val) { - if (isset($val['enabled']) && empty($val['enabled'])) continue; - print ''; print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); print ''; } - print ''; print '
'; @@ -117,21 +114,28 @@ if ($action == 'edit') } else { - print ''; - print ''; - - foreach($arrayofparameters as $key => $val) + if (! empty($arrayofparameters)) { - print ''; + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); - print '' . $conf->global->$key . '
'; + 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 '' . $conf->global->$key . '
'; + + print '
'; + print ''.$langs->trans("Modify").''; + print '
'; + } + else + { + print '
'.$langs->trans("NothingToSetup"); } - - print ''; - - print '
'; - print ''.$langs->trans("Modify").''; - print '
'; } @@ -140,3 +144,4 @@ dol_fiche_end(); llxFooter(); $db->close(); +