From 98a99b60f67da3b0a19e0168dc4e09bbf801f91e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 7 Nov 2025 12:14:12 +0000 Subject: [PATCH] Bug 41151: Revert multi-value display and export formatting changes This reverts commits: - 042b0e90bab "Bug 41151: Preserve multi-value formatting in datatable exports" - dc280faea41 "Bug 41151: Display multi-value additional fields as lists in datatables" These commits attempted to improve the display of multi-value additional fields in datatables by rendering them as lists and preserving newlines in exports. However, the implementation conflicted with existing DataTables export button formatting that strips newlines for security reasons (Bug 37727). The root issue is that Koha currently uses: - datatables.net-buttons 2.3.4 (from Feb 2023) - datatables.net-vue3 2.0.0 (requires DataTables 1.x) Native support for escapeExcelFormula (which would allow proper newline handling) requires: - datatables.net-buttons 3.2.0+ (introduced escapeExcelFormula) - datatables.net-vue3 3.x (for DataTables 2.x compatibility) This revert allows us to: 1. Create a separate bug for upgrading DataTables to version 2.x with Buttons 3.x for native formula escaping and better export handling 2. Re-implement the multi-value display feature with proper export support once the DataTables upgrade is complete The reverted functionality will be restored in future patches once the underlying DataTables infrastructure is upgraded. --- .../prog/js/vue/components/KohaTable.vue | 64 ++----------------- 1 file changed, 7 insertions(+), 57 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue index 56fa2d458bf..6ce067b8e46 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue @@ -115,49 +115,13 @@ export default { searchable_field => { var _customRender = (function (searchable_field) { var _render = function (data, type, row, meta) { - const fieldValues = - row._strings.additional_field_values - .filter( - field => - field.field_id == - searchable_field.extended_attribute_type_id - ) - .map(el => el.value_str); - - if (fieldValues.length === 0) { - return ""; - } - - const valueStr = fieldValues[0]; - - // Check if there are multiple comma-separated values - if (valueStr && valueStr.includes(",")) { - const values = valueStr - .split(",") - .map(v => v.trim()) - .filter(v => v); - if (values.length > 1) { - // For export, return newline-separated values - // CSV/Excel export will properly quote cells containing newlines - if (type === "export") { - return values.join("\n"); - } - // For display, return as unordered list - return ( - '" - ); - } - } - - // Single value, return as-is - return valueStr; + return row._strings.additional_field_values + .filter( + field => + field.field_id == + searchable_field.extended_attribute_type_id + ) + .map(el => el.value_str); }; return _render; })(searchable_field); @@ -377,17 +341,3 @@ export default { }, }; - - -- 2.51.1