From 1a249237a008cd53040a82830909c53cd25fbcd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Oct 2023 16:46:47 +0200 Subject: [PATCH] Debug v19 --- htdocs/modulebuilder/index.php | 143 ++++++++++++++++++++------------- 1 file changed, 87 insertions(+), 56 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 8a52beb32c3..ea3c130e970 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3868,13 +3868,13 @@ if ($module == 'initmodule') { print ''; } if ($key == 'propname' || $key == 'proplabel') { - print ''.$attribute.''; + print ''.$attribute.''; } elseif ($key == 'proptype') { - print ''.$attribute.'
'; + print ''.$attribute.'
'; } elseif ($key == 'propvalidate') { - print ''.$attribute.''; + print ''.$attribute.''; } else { - print ''.$attribute.''; + print ''.$attribute.''; } $counter++; if ($counter % 2 === 0) { @@ -4269,11 +4269,9 @@ if ($module == 'initmodule') { print '
'; print ''; print ''; - print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; // We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobject->fields may have been @@ -4425,7 +4423,7 @@ if ($module == 'initmodule') { print ''; - print ''; @@ -4515,7 +4513,7 @@ if ($module == 'initmodule') { print dol_escape_htmltag($propcomment); print ''; print ''; - print ''; - print ''; - print ''; @@ -5052,7 +5050,7 @@ if ($module == 'initmodule') { print ''; print ''; print ''; print ''; @@ -5066,35 +5064,49 @@ if ($module == 'initmodule') { } print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + // Position print ''; + // Enabled print ''; + // Perms print ''; print ''; - print ''; + print ''; - print ''; print ''; // end form for add menu + + //var_dump($menus); + if (count($menus)) { $i = 0; foreach ($menus as $menu) { @@ -5113,10 +5125,14 @@ if ($module == 'initmodule') { $propTarget = !empty($menu['target']) ? $menu['target'] : GETPOST('target'); $propEnabled = !empty($menu['enabled']) ? $menu['enabled'] : GETPOST('enabled'); - //Perms + // Perms + $propPerms = str_replace(array('$user->hasRight(', ')'), '', $propPerms); $arguments = explode(",", $propPerms); - $valPerms = trim($arguments[2], ' " "\)'); - $objPerms = trim($arguments[1], ' " "\)'); + + $objPerms = (empty($arguments[1]) ? '' : trim($arguments[1])); + $valPerms = (empty($arguments[2]) ? '' : trim($arguments[2])); + + //$tabobject = ''; // We can't know what is $tabobject in most cases if ($action == 'editmenu' && GETPOST('menukey', 'int') == $i) { //var_dump($propPerms);exit; @@ -5126,7 +5142,7 @@ if ($module == 'initmodule') { print ''; print ''; print ''; - print ''; + //print ''; print ''; @@ -5154,50 +5170,61 @@ if ($module == 'initmodule') { } print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + // Position + print ''; + // Enabled + print ''; - print ''; print ''; print ''; - print ''; @@ -5238,13 +5265,17 @@ if ($module == 'initmodule') { print dol_escape_htmltag($menu['langs']); print ''; + // Position print ''; + // Enabled print ''; + + // Perms print ''; - print ''; - print ''; - print ''; print ''; @@ -5499,7 +5530,7 @@ if ($module == 'initmodule') { print ''; print ''; - print ''; - print '
'; - + print ''; $htmltext = $langs->trans("PropertyDesc").'

'.$langs->trans("SeeExamples").''; print $form->textwithpicto($langs->trans("Code"), $htmltext, 1, 'help', 'extracss', 0, 3, 'propertyhelp'); - print '
'; print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")); @@ -4299,7 +4297,7 @@ if ($module == 'initmodule') { //print ''.$langs->trans("Disabled").''.$form->textwithpicto($langs->trans("Validate"), $langs->trans("ValidateModBuilderDesc")).''.$langs->trans("Comment").'
'; print ''; print ''; + print ''; print ''; print ''; print ''; + print ''; if ($propname != 'rowid') { print ''.img_edit().''; print ''.img_delete().''; @@ -4787,7 +4785,7 @@ if ($module == 'initmodule') { print ''; print ''; + print ''; print ''; print '
'; print ''; @@ -4838,7 +4836,7 @@ if ($module == 'initmodule') { print $dicts['tabcond'][$i]; print '
'; + print ''; print ''.img_edit().''; print ''.img_delete().''; print '
'; - print ''; print ''; print ''; - print ''; + $htmltext = ''.$langs->trans("Examples").':
'; + $htmltext .= '1 (always enabled)
'; + $htmltext .= '0 (always disabled)
'; + $htmltext .= 'isModEnabled(\''.dol_escape_htmltag($module).'\') (enabled when module is enabled)
'; + print $form->textwithpicto('', $htmltext); + /* + print ''; + */ print '
'; - print ''; print ''; foreach ($objects as $value) { print ''; } print ''; - print ''; print ''; print ''; + print ''; print ''; print '
'; print $i; print ''; - print ''; + print ''; + $htmltext = ''.$langs->trans("Examples").':
'; + $htmltext .= '1 (always enabled)
'; + $htmltext .= '0 (always disabled)
'; + $htmltext .= 'isModEnabled(\''.dol_escape_htmltag($module).'\') (enabled when module is enabled)
'; + print $form->textwithpicto('', $htmltext); + /* + print ''; + */ print '
'; + // Permissions + print ''; + print ''; + /* if (!empty($objPerms)) { print ''; - print ''; + if (!empty($valPerms)) { + print ''; + foreach ($crud as $key => $val) { + if ($valPerms != $key) { + print ''; + } } } print ''; } else { - print ''; print ''; foreach ($objects as $obj) { print ''; } print ''; - print ''; foreach ($crud as $key => $val) { print ''; } print ''; - } - + }*/ print ''; + print ''; print ''; print ''; print ''; print dol_escape_htmltag($menu['position']); print ''; - print (dol_escape_htmltag($menu['enabled']) == '0' ? $langs->trans("Hide") : $langs->trans("Show")); + print dol_escape_htmltag($menu['enabled']); print ''; if (strpos($menu['perms'], "\$user->hasRight") !== 0) { print ''; @@ -5268,7 +5299,7 @@ if ($module == 'initmodule') { print $menu['user']; // should not happen } print ''; + print ''; if ($menu['titre'] != 'Module'.$module.'Name') { print ''.img_edit().''; print ''.img_delete().''; @@ -5442,7 +5473,7 @@ if ($module == 'initmodule') { } print ''; print ''; + print ''; print ''; print '
'; + print ''; print ''; print '
'; print ''; @@ -5535,7 +5566,7 @@ if ($module == 'initmodule') { print $langs->trans($perm[1]); print '
'; + print ''; print ''.img_edit().''; print ''.img_delete().'';