From 30171f3df6381ec1a4120ff8739641f60758ef02 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Sat, 1 Nov 2025 14:11:31 +0000 Subject: [PATCH] Bug 41151: Preserve multi-value formatting in datatable exports This patch fixes the export functionality for repeatable additional fields in datatables. Previously, when exporting to CSV or Excel, multi-value fields displayed as HTML markup instead of properly formatted values. The fix detects when DataTables is requesting data for export (type === "export") and returns newline-separated values instead of HTML list markup. This ensures that: - CSV exports properly quote cells containing newlines - Excel exports display each value on a separate line within the cell - The visual list structure is maintained in exported data - Each field's values remain in the correct cell/row For example, a field with values "Bang, History" now exports as: Bang History (with each value on its own line within the same cell) This complements the display improvements made in the previous commits while ensuring exports remain clean and properly formatted. --- .../intranet-tmpl/prog/js/vue/components/KohaTable.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 0bade1bd343..56fa2d458bf 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue @@ -137,7 +137,12 @@ export default { .map(v => v.trim()) .filter(v => v); if (values.length > 1) { - // Return as unordered list + // 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 ( '