From 002ec257b0a3ded0742d7834b889a915a7328dec Mon Sep 17 00:00:00 2001 From: Victor Grousset Date: Wed, 10 Jan 2018 16:07:36 +0100 Subject: [PATCH] Bug 19928: Acquisitions' CSV exports now honors syspref "delimiter" Bonus fixes: - Basketgroup: there was an unnecessary space. " RRP tax excluded" replaced by "RRP tax excluded" - Late orders: - leading spaces before every line - surrounding spaces for [% orders.size %] Other changes: - quoted "Total orders in late" to no worry about additional spaces - Late orders: additional spaces which shouldn't be a problem because all the fields are enclosed by quotes. Test plan: 1. Set syspref "delimiter" to "#'s" 2. Change the language e.g. FR-fr 3. Create a vendor with minimal info 4. Create a basket with two items 5. Go to the basket. URL should be /cgi-bin/koha/acqui/basket.pl?basketno=XXXXX 6. Close this basket 7. "Export as CSV" 8. You should see that the file contains commas "," This is the bug. Leave the file open for future comparison to ensure that there are no regressions. 9. Create a basket group with two baskets (tick the close this basket group check box) 10. Go to the "Closed" tab to see your basket group 11. "Export as CSV" 12. You should see that the file contains commas "," This is the bug. Leave the file open for future comparison to ensure that there are no regressions. 13. Go to /cgi-bin/koha/acqui/lateorders.pl 14. Tick two orders. Of the same vendor, otherwise Koha won't let you tick orders of different vendors. 15. "Export as CSV" 16. You should see that the file contains commas "," This is the bug. Leave the file open for future comparison to ensure that there are no regressions. 17. Apply this patch 18. Translation stuff 1. cd misc/translator 2. perl translate update YOUR_LANG 3. manually edit the po file, remove the fuzzy tags. And translate the string. You can just copy the original and replace some parts by gibberish. 4. perl translate install YOUR_LANG 19. Re-export the same CSVs and compare with the original version to check that - delimiter syspref is honored - the headers are translatable - there is no whitespace regression (additional newlines or spaces) Signed-off-by: Mark Tompsett Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- .../en/includes/csv_headers/acqui/basket.tt | 5 ++- .../includes/csv_headers/acqui/basketgroup.tt | 5 ++- .../includes/csv_headers/acqui/lateorders.tt | 5 ++- .../prog/en/modules/acqui/csv/basket.tt | 19 ++++++++++- .../prog/en/modules/acqui/csv/basketgroup.tt | 32 ++++++++++++++++++- .../prog/en/modules/acqui/csv/lateorders.tt | 18 +++++++++-- 6 files changed, 77 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt index 60740d2657..b6e434f10f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt @@ -1 +1,4 @@ -[%- BLOCK -%]Contract name,Order number,Entry date,ISBN,Author,Title,Publication year,Publisher,Collection title,Note for vendor,Quantity,RRP,Delivery place,Billing place[%- END -%] +[%- USE Koha -%] +[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] + +[%- BLOCK -%]Contract name[% delimiter %]Order number[% delimiter %]Entry date[% delimiter %]ISBN[% delimiter %]Author[% delimiter %]Title[% delimiter %]Publication year[% delimiter %]Publisher[% delimiter %]Collection title[% delimiter %]Note for vendor[% delimiter %]Quantity[% delimiter %]RRP[% delimiter %]Delivery place[% delimiter %]Billing place[%- END -%] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt index 2f583b9705..81a33c78b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt @@ -1 +1,4 @@ -[%- BLOCK -%]Account number,Basket name,Order number,Author,Title,Publisher,Publication year,Collection title,ISBN,Quantity,RRP tax included, RRP tax excluded,Discount,Estimated cost tax included,Estimated cost tax excluded,Note for vendor,Entry date,Bookseller name,Bookseller physical address,Bookseller postal address,Contract number,Contract name,Basket group delivery place,Basket group billing place,Basket delivery place,Basket billing place[%- END -%] +[%- USE Koha -%] +[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] + +[%- BLOCK -%]Account number[% delimiter %]Basket name[% delimiter %]Order number[% delimiter %]Author[% delimiter %]Title[% delimiter %]Publisher[% delimiter %]Publication year[% delimiter %]Collection title[% delimiter %]ISBN[% delimiter %]Quantity[% delimiter %]RRP tax included[% delimiter %]RRP tax excluded[% delimiter %]Discount[% delimiter %]Estimated cost tax included[% delimiter %]Estimated cost tax excluded[% delimiter %]Note for vendor[% delimiter %]Entry date[% delimiter %]Bookseller name[% delimiter %]Bookseller physical address[% delimiter %]Bookseller postal address[% delimiter %]Contract number[% delimiter %]Contract name[% delimiter %]Basket group delivery place[% delimiter %]Basket group billing place[% delimiter %]Basket delivery place[% delimiter %]Basket billing place[%- END -%] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt index a853d5f9ed..29b77d503b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt @@ -1 +1,4 @@ -[%- BLOCK -%]ORDER DATE,ESTIMATED DELIVERY DATE,VENDOR,INFORMATION,TOTAL COST,BASKET,CLAIMS COUNT,CLAIMED DATE[%- END -%] +[%- USE Koha -%] +[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] + +[%- BLOCK -%]ORDER DATE[%- delimiter -%]ESTIMATED DELIVERY DATE[%- delimiter -%]VENDOR[%- delimiter -%]INFORMATION[%- delimiter -%]TOTAL COST[%- delimiter -%]BASKET[%- delimiter -%]CLAIMS COUNT[%- delimiter -%]CLAIMED DATE[%- END -%] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt index 3857b63bf6..ea32c7e50a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt @@ -1,6 +1,23 @@ +[%- USE Koha -%] +[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] + [%- INCLUDE csv_headers/acqui/basket.tt -%] [%- INCLUDE empty_line.inc -%] + [%- FOREACH r IN rows -%] -"[% r.contractname %]",[% r.ordernumber %],[% r.entrydate %],[% r.isbn %],"[% r.author %]","[% r.title %]",[% r.publicationyear %],"[% r.publishercode %]","[% r.collectiontitle %]","[% r.notes %]",[% r.quantity %],[% r.rrp %],"[% r.deliveryplace %]","[% r.billingplace %]" +"[% r.contractname %]"[%- delimiter -%] +[% r.ordernumber %][%- delimiter -%] +[% r.entrydate %][%- delimiter -%] +[% r.isbn %][%- delimiter -%] +"[% r.author %]"[%- delimiter -%] +"[% r.title %]"[%- delimiter -%] +[% r.publicationyear %][%- delimiter -%] +"[% r.publishercode %]"[%- delimiter -%] +"[% r.collectiontitle %]"[%- delimiter -%] +"[% r.notes %]"[%- delimiter -%] +[% r.quantity %][%- delimiter -%] +[% r.rrp %][%- delimiter -%] +"[% r.deliveryplace %]"[%- delimiter -%] +"[% r.billingplace %]" [%- INCLUDE empty_line.inc -%] [%- END -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt index b421ed211f..f3715ca5a4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt @@ -1,6 +1,36 @@ +[%- USE Koha -%] +[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] + [%- USE Price -%] [%- INCLUDE csv_headers/acqui/basketgroup.tt -%] [%- INCLUDE empty_line.inc -%] -[%- FOREACH r IN rows -%][% r.clientnumber %],"[% r.basketname %]",[% r.ordernumber %],"[% r.author %]","[% r.title %]","[% r.publishercode %]",[% r.publicationyear %],"[% r.collectiontitle %]",[% r.isbn %],[% r.quantity %],[% r.rrp_tax_included | $Price %],[% r.rrp_tax_excluded | $Price %],[% r.discount %],[% r.ecost_tax_included | $Price %],[% r.ecost_tax_excluded | $Price %],"[% r.notes %]",[% r.entrydate %],"[% r.booksellername %]","[% r.bookselleraddress %]","[% r.booksellerpostal %]",[% r.contractnumber %],"[% r.contractname %]","[% r.basketgroupdeliveryplace %]","[% r.basketgroupbillingplace %]","[% r.basketdeliveryplace %]","[% r.basketbillingplace %]" + +[%- FOREACH r IN rows -%] +[% r.clientnumber %][%- delimiter -%] +"[% r.basketname %]"[%- delimiter -%] +[% r.ordernumber %][%- delimiter -%] +"[% r.author %]"[%- delimiter -%] +"[% r.title %]"[%- delimiter -%] +"[% r.publishercode %]"[%- delimiter -%] +[% r.publicationyear %][%- delimiter -%] +"[% r.collectiontitle %]"[%- delimiter -%] +[% r.isbn %][%- delimiter -%] +[% r.quantity %][%- delimiter -%] +[% r.rrp_tax_included | $Price %][%- delimiter -%] +[% r.rrp_tax_excluded | $Price %][%- delimiter -%] +[% r.discount %][%- delimiter -%] +[% r.ecost_tax_included | $Price %][%- delimiter -%] +[% r.ecost_tax_excluded | $Price %][%- delimiter -%] +"[% r.notes %]"[%- delimiter -%] +[% r.entrydate %][%- delimiter -%] +"[% r.booksellername %]"[%- delimiter -%] +"[% r.bookselleraddress %]"[%- delimiter -%] +"[% r.booksellerpostal %]"[%- delimiter -%] +[% r.contractnumber %][%- delimiter -%] +"[% r.contractname %]"[%- delimiter -%] +"[% r.basketgroupdeliveryplace %]"[%- delimiter -%] +"[% r.basketgroupbillingplace %]"[%- delimiter -%] +"[% r.basketdeliveryplace %]"[%- delimiter -%] +"[% r.basketbillingplace %]" [%- INCLUDE empty_line.inc -%] [%- END -%] 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 2234688610..7a62124c73 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,8 +1,22 @@ +[%- USE Koha -%] +[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] + [%- USE KohaDates -%] [%- INCLUDE csv_headers/acqui/lateorders.tt -%] [%- INCLUDE empty_line.inc -%] + [%- 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 %]" +"[% o.orderdate %] ([% o.latesince %] days)"[%- delimiter -%] +"[% o.estimateddeliverydate | $KohaDates %]"[%- delimiter -%] +"[% o.supplier (o.supplierid) %]"[%- delimiter -%] +"[% o.title %] [% IF o.author %]Author: [% o.author %].[% END %][% IF o.publisher %]Published by: [% o.publisher %].[% END %]"[%- delimiter -%] +"[% o.unitpricesupplier %] x [% o.quantity_to_receive %] = [% o.subtotal %] ([% o.budget %])"[%- delimiter -%] +"[% o.basketname %] ([% o.basketno %])"[%- delimiter -%] +"[% o.claims_count %]"[%- delimiter -%] +"[% o.claimed_date %]" [%- INCLUDE empty_line.inc -%] [%- END -%] -,,Total orders in late, [% orders.size %] +[%- delimiter -%] +[%- delimiter -%] +"Total orders in late"[%- delimiter -%] +[% orders.size %] \ No newline at end of file -- 2.39.5