]> git.koha-community.org Git - koha.git/commit
Bug 18331: Fix CSV export (once and for all!)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 12 Jun 2017 20:04:47 +0000 (17:04 -0300)
committerKatrin Fischer <katrin.fischer.83@web.de>
Sun, 10 Sep 2017 08:33:37 +0000 (10:33 +0200)
commit9cefbaf964772848cc338a910d55c558bf579d1a
tree66eb5abc761b2c7cc2674da9efd7f10a94bd2288
parentb06a26fa83f6af37ee098ac0101deff786beca6e
Bug 18331: Fix CSV export (once and for all!)

I am going to try and explain the problem here in order to make it a
have-to-read for next changes.

There are several things to test when and most of the time we break
something when we try to fix something else.

You have to test different CSV export, not only one. There are not all
processed the same way. For instance acqui/csv/basket.tt does not
contain any strings to translate and the translate script will copy the
original file as it.
But reports/csv/orders_by_budget.tt will not! Indeed it contains "TOTAL"
which will be translated. The generated tt file for the translated
language will remove all the carriage returns! That's why we cannot rely
on TT for newlines (contrary to bug 16914 assumption).

There are two possible methods:
1/ Fix the translate script
=> Hum... nope
2/ Remove all carriage returns and make them explicit by including an
file that only contains 1 carriage return

This second method is implemented in this patch.

How it works: Use the PRE_CHOMP "[%-" and POST_CHOMP "-%]"
(http://www.template-toolkit.org/docs/manual/Config.html#section_PRE_CHOMP_POST_CHOMP)
to remove all the newlines that could be added by TT in the original
(en) files. Then include the new_line.inc to add a new line.
That way original and translated files will behave the same way.
The BLOCK in the csv_headers avoid to have the newlines added, in any
cases. For instance: by default we will have an empty line at the end of
the headers, but the translated headers will not have it.

Test plan:
At least 2 signoffs will be needed, please test carefully!
You will need to generate CSV with at least 2 entries!
Test with the non-translated interface (en) and with the language you
want. To test with a translated language you will *have to*:
- cd misc/translator
- perl translate update LANG
- manually edit the po file, remove the fuzzy tags, correctly translate
the string (do not forget the additional %s in the headers)
- perl translate install LANG
1/ Export basket and basketgroup as CSV
2/ Export late orders as CSV
3/ Export items (from the item search) as CSV
4/ Export the 2 reports "Orders by fund" and "Cash register" as CSV

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8403799c7212349bee70090249e3425afd62423b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 5b1c9cd3f27d377ddee5635f32fd1a3e2626409c)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
13 files changed:
koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt
koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt
koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt
koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt
koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/reports/cash_register_stats.tt
koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/reports/orders_by_budget.tt
koha-tmpl/intranet-tmpl/prog/en/includes/empty_line.inc [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_csv.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/csv/cash_register_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/csv/orders_by_budget.tt