Bug 29968

Summary: CSV export of cash register misses newlines
Product: Koha Reporter: Michael Kuhn <mik>
Component: ReportsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: koha, maude.boudreau
Version: 21.11   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 29271    
Bug Blocks:    

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 -%]
Comment 8 Koha collecto 2024-05-24 18:43:12 UTC
+1