diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index e5625b0f975..895ce8c1b08 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -32,10 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; // Load translation files required by the page $langs->load("admin"); -if (!$user->admin) { - accessforbidden(); -} - $rowid = GETPOST('rowid', 'int'); $entity = GETPOST('entity', 'int'); $action = GETPOST('action', 'aZ09'); @@ -44,7 +40,6 @@ $consts = GETPOST('const', 'array'); $constname = GETPOST('constname', 'alphanohtml'); $constvalue = GETPOST('constvalue', 'restricthtml'); // We should be able to send everything here $constnote = GETPOST('constnote', 'alpha'); - // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -63,12 +58,30 @@ if (empty($sortorder)) { $sortorder = 'ASC'; } +if ($action == 'add' && GETPOST('update')) { // Click on button update must be used in priority before param $action + $action = 'update'; +} +if ($action == 'add' && GETPOST('delete')) { // Click on button update must be used in priority before param $action + $action = 'delete'; +} +if ($action == 'update' && GETPOST('add')) { // Click on button add must be used in priority before param $action + $action = 'add'; +} +if ($action == 'delete' && GETPOST('add')) { // Click on button add must be used in priority before param $action + $action = 'add'; +} + +if (!$user->admin) { + accessforbidden(); +} + /* * Actions */ -if ($action == 'add' || (GETPOST('add') && $action != 'update')) { +// Add a new record +if ($action == 'add') { $error = 0; if (empty($constname)) { @@ -157,13 +170,12 @@ jQuery(document).ready(function() { jQuery("#delconst").hide(); jQuery(".checkboxfordelete").click(function() { jQuery("#delconst").show(); - jQuery("#action").val('delete'); }); jQuery(".inputforupdate").keyup(function() { // keypress does not support back var field_id = jQuery(this).attr("id"); var row_num = field_id.split("_"); jQuery("#updateconst").show(); - jQuery("#action").val('update'); + jQuery("#action").val('update'); // so default action if we type enter will be update, but correct action is also detected correctly without that when clicking on "Update" button. jQuery("#check_" + row_num[1]).prop("checked",true); }); }); @@ -180,7 +192,7 @@ $param = ''; print '
entity) && $debug) ? '?debug=1' : '').'" method="POST">'; print ''; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b006978d5fa..e7d94fe0d8c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7603,7 +7603,7 @@ div.clipboardCPValue.hidewithsize { } .dropdown dd ul { - max-width: 350px; + max-width: 370px; } } /* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */