From c5f7e5080a575e5a3b0b8a344f01fb7834fe1549 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 8 Oct 2024 11:45:58 +0200 Subject: [PATCH] Bug 33484: Early return in add_filters if node does not exist Maybe we could even return early from kohaTable? Signed-off-by: Pedro Amorim Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index c560bd729bd..5b7de460846 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -841,6 +841,8 @@ function _dt_on_visibility(add_filters, table_node, table_dt){ function _dt_add_filters(table_node, table_dt, filters_options = {}) { + if (!table_node.length) return; + $(table_node).find('thead tr:eq(1)').remove(); // Remove if one exists already $(table_node).find('thead tr').clone().appendTo( $(table_node).find('thead') ); -- 2.34.1