From 3e714ce3050d8bbfbf5dc207d536d5ce41bfa7e3 Mon Sep 17 00:00:00 2001
From: Nick Clemens
Date: Tue, 30 Jul 2019 15:20:27 +0000
Subject: [PATCH] Bug 23389: Add 'All' option to report dropdowns
This patch optionally adds an 'all' option to report dropdowns
Note you will need to use 'LIKE' instead of '=' to allow 'All' to work
To test:
1 - Write a report:
SELECT branchname FROM branches WHERE branchcode LIKE <>
2 - Run it
3 - Select a branch
4 - You get one branch info
5 - Note you cannot select all
6 - Apply patch
7 - Run report
8 - No change
9 - Update report like:
SELECT branchname FROM branches WHERE branchcode LIKE <>
10 - Run report
11 - Select 'All'
12 - You get all branches
13 - Select one branch
14 - You get one branch
15 - Test with other authorised categories (itemtypes, YES_NO, etc.)
16 - Confirm it works as expected
17 - Prove -v t/db_dependent/Reports/Guided.t
Signed-off-by: Lisette Scheer
Signed-off-by: Katrin Fischer
Signed-off-by: Martin Renvoize
(cherry picked from commit 7c97f5263d474adc11688b9b7773c5b8705d10d3)
Signed-off-by: Hayley Mapley
---
C4/Reports/Guided.pm | 1 +
.../prog/en/modules/reports/guided_reports_start.tt | 1 +
reports/guided_reports.pl | 11 ++++++-----
t/db_dependent/Reports/Guided.t | 6 ++++--
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm
index ea1dac0550..81ac48870f 100644
--- a/C4/Reports/Guided.pm
+++ b/C4/Reports/Guided.pm
@@ -914,6 +914,7 @@ sub GetParametersFromSQL {
for ( my $i = 0; $i < ($#split/2) ; $i++ ) {
my ($name,$authval) = split(/\|/,$split[$i*2+1]);
+ $authval =~ s/\:all$// if $authval;
push @sql_parameters, { 'name' => $name, 'authval' => $authval };
}
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 8d9fbfbe68..a4f3669de6 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
@@ -681,6 +681,7 @@ canned reports and writing custom SQL reports.