diff --git a/ajax/question_add.php b/ajax/question_add.php index 3055a6397..6f6c8ade3 100644 --- a/ajax/question_add.php +++ b/ajax/question_add.php @@ -41,9 +41,7 @@ } if (!$question->add($_REQUEST)) { - http_response_code(500); - echo array_shift($_SESSION['MESSAGE_AFTER_REDIRECT'][ERROR]); - unset($_SESSION['MESSAGE_AFTER_REDIRECT'][ERROR]); + http_response_code(400); exit; } $json = [ diff --git a/js/scripts.js.php b/js/scripts.js.php index e9c805e68..e291948ce 100644 --- a/js/scripts.js.php +++ b/js/scripts.js.php @@ -817,13 +817,9 @@ function buildTiles(list) { data: form.serializeArray(), dataType: 'json' }).fail(function(data) { - // Closing and opening the modal workarounds - // the whole modal being disabled when alert is shown - // modalWindow.dialog('close'); - // alert(data.responseText); - // modalWindow.dialog('open'); - $('#plugin_formcreator_error').text(data.responseText); - $('#plugin_formcreator_error').show(); + // fix for GLPI <= 9.5.2 + $('[id^="message_after_redirect_"]').remove(); + displayAjaxMessageAfterRedirect(); }).done(function(data) { var sectionId = form.find('select[name="plugin_formcreator_sections_id"]').val(); var container = $('[data-itemtype="PluginFormcreatorSection"][data-id="' + sectionId + '"] .grid-stack');