From bcc1c6c3fd19fe25d00b0fae4862a6b90b215ca5 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 7 Feb 2023 22:00:18 +0000 Subject: [PATCH] Bug 32904: Check if responseJSON is defined for dataTable error This patch checks if responseJSON is defined before checking if responseJSON.errors is defined. Sponsored-by: Education Services Australia SCIS Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 9d72cf3730..f6e0834f22 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -496,7 +496,7 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { alert(__("Something went wrong when loading the table.\n%s: %s. \n%s").format( settings.jqXHR.status, settings.jqXHR.statusText, - settings.jqXHR.responseJSON.errors ? settings.jqXHR.responseJSON.errors.map(m => m.message).join("\n") : '' + ( settings.jqXHR.responseJSON && settings.jqXHR.responseJSON.errors ) ? settings.jqXHR.responseJSON.errors.map(m => m.message).join("\n") : '' )); } else { alert(__("Something went wrong when loading the table.")); -- 2.39.5