Bugzilla – Attachment 114376 Details for
Bug 22038
When exporting account table to excel, decimal is lost
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22038: Fix excel export if CurrencyFormat is FR
Bug-22038-Fix-excel-export-if-CurrencyFormat-is-FR.patch (text/plain), 2.99 KB, created by
Didier Gautheron
on 2020-12-14 11:24:09 UTC
(
hide
)
Description:
Bug 22038: Fix excel export if CurrencyFormat is FR
Filename:
MIME Type:
Creator:
Didier Gautheron
Created:
2020-12-14 11:24:09 UTC
Size:
2.99 KB
patch
obsolete
>From d7e1d5579153e89c91635470fa2fa77dd557f1ab Mon Sep 17 00:00:00 2001 >From: Didier Gautheron <didier.gautheron@biblibre.com> >Date: Fri, 11 Dec 2020 10:46:04 +0100 >Subject: [PATCH] Bug 22038: Fix excel export if CurrencyFormat is FR > >DataTables excel export is broken if number decimal separator is a comma. > >Test plan: >1 - Set syspref CurrencyFormat to US >2 - Export as excel a table with decimal numbers, patrons list with fines >for example. >3 - Open in libreoffice or excel, numbers are ok. >4 - Set syspref CurrencyFormat to FR >5 - Export and open again, number are wrong 25,10 is imported as 2510 >6 - Apply patch >7 - Redo 1 to 4 >8 - Excel export, number is 25,10 >--- > .../prog/en/includes/columns_settings.inc | 47 ++++++++++++++++++---- > 1 file changed, 39 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >index 9a5eb315f5..17ee15375d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc >@@ -1,3 +1,4 @@ >+[% USE Koha %] > [% USE TablesSettings %] > <!-- columns_settings.inc --> > >@@ -41,16 +42,22 @@ function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) { > } > } > >+ var export_numeric = { >+ body: function ( data, row, column, node ) { >+ var newnode = $(node); >+ >+ if ( newnode.find(".noExport").length > 0 ) { >+ newnode = newnode.clone(); >+ newnode.find(".noExport").remove(); >+ } >+ let tp = newnode.text().replace( /\n/g, ' ' ).trim(); >+ tp = $('<p>' + tp + '</p>').text(); >+ return $.isNumeric(tp.replace(',', '.')) ? tp.replace(',', '.') : tp; >+ } >+ } >+ > var export_buttons = [ > { >- extend: 'excelHtml5', >- text: _("Excel"), >- exportOptions: { >- columns: exportColumns, >- format: export_format >- }, >- }, >- { > extend: 'csvHtml5', > text: _("CSV"), > exportOptions: { >@@ -76,6 +83,30 @@ function KohaTable(id_selector, dt_parameters, columns_settings, add_filters) { > } > ]; > >+ [% IF Koha.Preference("CurrencyFormat") != 'FR' %] >+ export_buttons.unshift ( >+ { >+ extend: 'excelHtml5', >+ text: _("Excel"), >+ exportOptions: { >+ columns: exportColumns, >+ format: export_format >+ }, >+ } >+ ); >+ [% ELSE %] >+ export_buttons.unshift ( >+ { >+ extend: 'excelHtml5', >+ text: _("Excel"), >+ exportOptions: { >+ columns: exportColumns, >+ format: export_numeric >+ }, >+ } >+ ); >+ [% END %] >+ > dt_parameters[ "buttons" ] = [ > { > fade: 100, >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22038
:
114335
|
114376
|
122350
|
128674
|
132301