Bug 16914: Rely on TT for newlines
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 22 Dec 2016 15:45:08 +0000 (12:45 -0300)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Thu, 22 Dec 2016 20:26:54 +0000 (20:26 +0000)
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 <chosen language>
- Enable <chosen language> (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 <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch_csv.tt

index 82e014c..5e38a58 100644 (file)
@@ -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 %]"
index 2e24b67..34b2226 100644 (file)
@@ -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 %]
index 49878c4..9ac5047 100644 (file)
@@ -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 -%]