From b359a71f2661e4977bc3885d4b4432245dc9c9e0 Mon Sep 17 00:00:00 2001
From: Nick Clemens
Date: Mon, 15 Jan 2018 14:11:29 +0000
Subject: [PATCH] Bug 9634: Allow for combining same paraneters in SQL reports
This patch combines report paramters with the same name and data type
(authorised value)
This presereves the past ability to provide all parameters as
'sql_params' in order to preserve existing public report links
To test:
1 - Create a report that takes multiple parameters, e.g.:
SELECT <> AS one, <> AS two, <> as three,
<> as four, <> as five
2 - Run this report, note you are asked for five parameters
3 - Apply patch
4 - Update database
5 - Run report, note you are asked for three params
6 - Verify the results reflect the supplied parameters
7 - Export the report and verify results
8 - Alter the URL and provide 5 params as sql_params and no param_name
variables i.e.
http://localhost:8081/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Run+this+report&sql_params=Banana&sql_params=CPL&sql_params=0&sql_params=Orange&sql_params=LPL
9 - Verify results come out as expected. i.e. 5 different values that
are those of the URL.
Signed-off-by: Victor Grousset
---
.../prog/en/includes/reports-toolbar.inc | 1 +
.../en/modules/reports/guided_reports_start.tt | 1 +
reports/guided_reports.pl | 22 +++++++++++++++++-----
3 files changed, 19 insertions(+), 5 deletions(-)
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 9b3a562..99ce946 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
@@ -50,6 +50,7 @@
[% IF ( execute ) %]
[% BLOCK params %]
[%- FOREACH param IN sql_params %]&sql_params=[% param %][% END %]
+ [%- FOREACH param_name IN param_names %]¶m_name=[% param_name %][% END %]
[%- END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
index 28e0c17..d0008ef 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
@@ -662,6 +662,7 @@ canned reports and writing custom SQL reports.