From 6d3b6c695fe1267964b85db2cc7320254651ab37 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 18 Jun 2025 13:42:28 +0200 Subject: [PATCH] Bug 40161: (bug 38255 follow-up) Fix item type translation JS error Uncaught (in promise) TypeError: table.row is undefined We need to use the DataTable object. Test plan: Have several languages installed Edit an item type and click "Translate into other languages" to open the modal Translate into another language and note that: Without this patch you get a JS error in the browser console and the row is not added to the table With this patch applied the row is added correctly with your translation --- .../intranet-tmpl/prog/en/modules/admin/localization.tt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt index 199502cdafc..e49f2ac5278 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt @@ -198,11 +198,12 @@ $(document).ready(function() { $(".dialog").hide(); - var table = $("#localization").kohaTable({ + let table = $("#localization").kohaTable({ dom: "t", paging: false, autoWidth: false, }); + let table_dt = table.DataTable(); var languages_select = $(''); [% FOR language IN languages %] @@ -275,7 +276,7 @@ if ( success.error ) { show_message({ type: 'error_on_insert', data: success }); } else { - var new_row = table.row.add( [ success.id, success.entity, success.code, success.lang, success.translation, " Delete" ] ).draw().node(); + var new_row = table_dt.row.add( [ success.id, success.entity, success.code, success.lang, success.translation, " Delete" ] ).draw().node(); $( new_row ).attr("id", "row_id_" + success.id ).data("id", success.id ); show_message({ type: 'success_on_insert', data: success }); } -- 2.34.1