Bug 29968 - CSV export of cash register misses newlines
Summary: CSV export of cash register misses newlines
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: 21.11
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
: 30704 (view as bug list)
Depends on: 29271
Blocks:
  Show dependency treegraph
 
Reported: 2022-01-28 10:59 UTC by Michael Kuhn
Modified: 2022-09-07 19:09 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kuhn 2022-01-28 10:59:18 UTC
When using the German language (and maybe other languages) and accessing Koha menu "Reports > Cash register" and exporting the output, the resulting CSV file does not contain the newline character, so all records will be in one line which is incorrect.

This problem does not appear when using the English language so using the English interface can be used as a workaround.
Comment 1 Katrin Fischer 2022-02-19 21:35:27 UTC
This is probably due to the translation tools removing \n new lines. There is also a common fix for this we used for other csv exports.
Comment 2 Katrin Fischer 2022-08-09 13:16:45 UTC
Confirmed in 20.11
Comment 3 Katrin Fischer 2022-08-09 13:37:42 UTC
I thik 29271 is the culprit, as it removed the explicit newlines:

[%- INCLUDE empty_line.inc -%]

They are not needed in English, but very much needed for the translated templates, as the translation process removes any new lines...
Comment 4 Katrin Fischer 2022-08-09 13:46:15 UTC
This appears to work well:

[%- USE ItemTypes -%]
[%- INCLUDE csv_headers/reports/cash_register_stats.tt -%]
[%- INCLUDE empty_line.inc -%]
[%- FOREACH row IN rows -%]
 [%- FOREACH field IN row; field IF !loop.last; ItemTypes.GetDescription(field) IF loop.last; sep IF !loop.last; END -%]
 [%- INCLUDE empty_line.inc -%]
[%- END -%]
TOTAL[%- INCLUDE empty_line.inc -%]
Comment 5 Katrin Fischer 2022-08-09 14:03:26 UTC
Hm, have to check into the total not getting printed (might be our old version, but in case someone wants to do more work here)
Comment 6 Katrin Fischer 2022-08-09 14:08:40 UTC
*** Bug 30704 has been marked as a duplicate of this bug. ***
Comment 7 Katrin Fischer 2022-08-09 14:56:42 UTC
Minor correction for the TOTAL line:

[%- USE ItemTypes -%]
[%- INCLUDE csv_headers/reports/cash_register_stats.tt -%]
[%- INCLUDE empty_line.inc -%]
[%- FOREACH row IN rows -%]
 [%- FOREACH field IN row; field IF !loop.last; ItemTypes.GetDescription(field) IF loop.last; sep IF !loop.last; END -%]
 [%- INCLUDE empty_line.inc -%]
[%- END -%]
TOTAL[% sep %][%- FOREACH field IN total; field; sep IF !loop.last; END -%]