From 02491b08d36a746a470679f9766b39bd132e33b9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 27 Aug 2026 16:45:08 +0200 Subject: [PATCH] Bug 43394: DT - Cast pageLength to Integer In "Edit patron card batch" the pageLength is coming from the syspref, the value is a string. But DataTable's needs an integer. Let's fix this in datatables.js, in the kohaTable's constructor Test plan: Got to cgi-bin/koha/patroncards/edit-batch.pl Enter more than 20 borrowernumbers and "Add patron(s)" Click "next" and notice that with this patch the pagination works. Without this patch the JS error is "Uncaught TypeError: can't access property "nTr", p is undefined" Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Pedro Amorim --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 96817862cc..c8d0a2e138 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -1585,6 +1585,13 @@ function update_search_description( } } + if ( + settings.pageLength !== undefined && + !Number.isInteger(settings.pageLength) + ) { + settings.pageLength = parseInt(settings.pageLength, 10); + } + settings["buttons"] = _dt_buttons({ settings, table_settings }); var default_column_defs = [