From 6c9e7f10aeedd5b5d9e6d14f5738fe2d0c470509 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Wed, 3 Jan 2018 14:07:17 +0000
Subject: [PATCH] Bug 19910 - Use the delimiter syspref to name download link

To test:
1 - Set delimiter syspref to anything but comma
2 - Donwload report results as comma separated text
3 - They actually follow the syspref
4 - Apply patch
5 - Download link should now match pref selection
6 - Change pref, note link changes
7 - Verify things still work as expected
---
 koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc  | 8 ++++++++
 koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc
new file mode 100644
index 0000000..e6b4aca
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc
@@ -0,0 +1,8 @@
+[% SWITCH Koha.Preference('delimiter') %]
+    [% CASE '#' %]Pound (#) separated text (.csv)
+    [% CASE ',' %]Comma separated text (.csv)
+    [% CASE '/' %]Slash separated text (.csv)
+    [% CASE ';' %]Semicolon separated text (.csv)
+    [% CASE '\\' %]Backslash separated text (.csv)
+    [% CASE 'tabulation' %]Tab separated text (.csv)
+[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
index 00edf94..f9ac4c9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
@@ -51,10 +51,11 @@
                 [% FOREACH param IN sql_params %]&amp;sql_params=[% param %][% END %]
             [% END %]
 
+
             <div class="btn-group">
                 <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" id="format"><i class="fa fa-upload"></i> Download <span class="caret"></span></button>
                 <ul class="dropdown-menu">
-                    <li><a id="csv" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&amp;format=csv&amp;report_id=[% id %]&amp;reportname=[% name |uri %][% PROCESS params %]">Comma separated text</a></li>
+                    <li><a id="csv" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&amp;format=csv&amp;report_id=[% id %]&amp;reportname=[% name |uri %][% PROCESS params %]">[% PROCESS 'delimiter_text.inc' %]</a></li>
                     <li><a id="tab" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&amp;format=tab&amp;report_id=[% id %]&amp;reportname=[% name |uri %][% PROCESS params %]">Tab separated text</a></li>
                     <li><a id="ods" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&amp;format=ods&amp;report_id=[% id %]&amp;reportname=[% name |uri %][% PROCESS params %]">Open Document Spreadsheet</a></li>
                 </ul>
-- 
2.1.4