Skip to content

Commit

Permalink
fix(question): better error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Feb 4, 2021
1 parent b99b19b commit 051184a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions ajax/question_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
10 changes: 3 additions & 7 deletions js/scripts.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 051184a

Please sign in to comment.