From b010aa4d0ab5efad4f75713b9a48ec8102496b28 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 22 Dec 2016 12:45:08 -0300 Subject: [PATCH] Bug 16914: Rely on TT for newlines The translation scripts have an historical tendency to chomp newlines and we introduced an empty_line.inc file to force newlines when building CSV output out of our templates (in item search and late orders). This patch makes the mentioned templates use TT ability to force newlines plus some misuses of the 'minus' sign. Test plan: - Apply the patch - Do an item search that returns more than one result - Export as CSV => SUCCESS: The CSV file is correctly formed. - Install any translation: $ sudo koha-shell kohadev k$ cd kohaclone/misc/translator k$ perl translate install - Enable (e.g. es-ES) - Repeat the item search - Export as CSV => SUCCESS: The CSV file is correctly formed in your chosen language. - Have more than one late orders (bummer) - Go to late orders - Choose them - Export as CSV (in english) => SUCCESS: The CSV file is correctly formed. - Switch language - Go to late orders - Choose them - Export as CSV (in english) => SUCCESS: The CSV file is correctly formed in your chosen language. - Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- .../prog/en/includes/catalogue/itemsearch_item.csv.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt | 9 +++++---- .../intranet-tmpl/prog/en/modules/catalogue/itemsearch_csv.tt | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc index 82e014c..5e38a58 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc @@ -2,4 +2,4 @@ [%- USE Koha -%] [%- biblio = item.biblio -%] [%- biblioitem = item.biblioitem -%] -"[% biblio.title |html %] [% IF ( Koha.Preference( 'marcflavour' ) == 'UNIMARC' && biblio.author ) %]by [% END %][% biblio.author |html %]", "[% (biblioitem.publicationyear || biblio.copyrightdate) |html %]", "[% biblioitem.publishercode |html %]", "[% biblioitem.collectiontitle |html %]", "[% item.barcode |html %]", "[% item.itemcallnumber |html %]", "[% Branches.GetName(item.homebranch) |html %]", "[% Branches.GetName(item.holdingbranch) |html %]", "[% item.location |html %]", "[% item.stocknumber |html %]", "[% item.status |html %]", "[% (item.issues || 0) |html %]"[% INCLUDE 'empty_line.inc' %] +"[% biblio.title |html %] [% IF ( Koha.Preference( 'marcflavour' ) == 'UNIMARC' && biblio.author ) %]by [% END %][% biblio.author |html %]", "[% (biblioitem.publicationyear || biblio.copyrightdate) |html %]", "[% biblioitem.publishercode |html %]", "[% biblioitem.collectiontitle |html %]", "[% item.barcode |html %]", "[% item.itemcallnumber |html %]", "[% Branches.GetName(item.homebranch) |html %]", "[% Branches.GetName(item.holdingbranch) |html %]", "[% item.location |html %]", "[% item.stocknumber |html %]", "[% item.status |html %]", "[% (item.issues || 0) |html %]" diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt index 2e24b67..34b2226 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt @@ -1,5 +1,6 @@ -[% USE KohaDates %][% INCLUDE csv_headers/acqui/lateorders.tt %] -[% FOREACH o IN orders %][% INCLUDE 'empty_line.inc' %]"[% o.orderdate %] ([% o.latesince %] days)","[% o.estimateddeliverydate | $KohaDates %]","[% o.supplier (o.supplierid) %]","[% o.title %] [% IF o.author %]Author: [% o.author %].[% END %][% IF o.publisher %]Published by: [% o.publisher %].[% END %]","[% o.unitpricesupplier %] x [% o.quantity_to_receive %] = [% o.subtotal %] ([% o.budget %])","[% o.basketname %] ([% o.basketno %])","[% o.claims_count %]","[% o.claimed_date %]" -[% END %] -[% INCLUDE 'empty_line.inc' %] +[%- USE KohaDates -%] +[%- INCLUDE csv_headers/acqui/lateorders.tt +%] +[% FOREACH o IN orders %] +"[% o.orderdate %] ([% o.latesince %] days)","[% o.estimateddeliverydate | $KohaDates %]","[% o.supplier (o.supplierid) %]","[% o.title %] [% IF o.author %]Author: [% o.author %].[% END %][% IF o.publisher %]Published by: [% o.publisher %].[% END %]","[% o.unitpricesupplier %] x [% o.quantity_to_receive %] = [% o.subtotal %] ([% o.budget %])","[% o.basketname %] ([% o.basketno %])","[% o.claims_count %]","[% o.claimed_date +%]" +[% END +%] ,,Total orders in late, [% orders.size %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_csv.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_csv.tt index 49878c4..9ac5047 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_csv.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_csv.tt @@ -1,4 +1,4 @@ [% INCLUDE csv_headers/catalogue/itemsearch.tt %] [% FOREACH item IN results -%] - [%- INCLUDE 'catalogue/itemsearch_item.csv.inc' item = item -%] + [% INCLUDE 'catalogue/itemsearch_item.csv.inc' item = item +%] [%- END -%] -- 2.1.4