From bd7d64604b2454131c2fea197f03dea672f23519 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Sat, 27 Jul 2019 13:07:18 +0000 Subject: [PATCH] Bug 23390: Introduce placeholder syntax for report column names This patch adds the ability to rename columns in MySQL reports using a syntax: [[column|alias]] To test: 1 - Write a report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 2 - Run report 3 - Note you can batch modify the patrons 4 - Update report: SELECT cardnumber AS library_barcode FROM borrowers WHERE cardnumber LIKE '%9' 5 - Run report 6 - Note batch options are no longer present 7 - Apply patch 8 - Run report, no change 9 - Update report like: SELECT [[cardnumber|library_barcode]] FROM borrowers WHERE cardnumber LIKE '%9' 10 - Run report 11 - Batch options work! 12 - Update report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 13 - Verify batch options still work 14 - Set report 'public' 15 - Verify report can be run via JSON URLs: http://kohadev.mydnsname.org:8080/cgi-bin/koha/svc/report?id=1 http://kohadev.mydnsname.org:8081/cgi-bin/koha/svc/report?id=1 Signed-off-by: George Williams --- .../prog/en/modules/reports/guided_reports_start.tt | 18 +++++++++--------- opac/svc/report | 1 + reports/guided_reports.pl | 16 ++++++++++++++-- svc/report | 1 + 4 files changed, 25 insertions(+), 11 deletions(-) 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 45f3789c20..f41d21bef6 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 @@ -737,7 +737,7 @@ canned reports and writing custom SQL reports.

[% # Preserve the whitespace of the following textarea in order to format the values correctly %] - @@ -745,7 +745,7 @@ canned reports and writing custom SQL reports.

[% # Preserve the whitespace of the following textarea in order to format the values correctly %] - @@ -754,7 +754,7 @@ canned reports and writing custom SQL reports.

[% FOREACH result IN results %] [% FOREACH cells IN result.cells %] [% place = loop.index %] - [% IF header_row.$place.cell == 'itemnumber' %] + [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %] [% SET batch_itemnumbers = 1 %] [% END %] @@ -768,7 +768,7 @@ canned reports and writing custom SQL reports.

[% FOREACH result IN results %] [% FOREACH cells IN result.cells %] [% place = loop.index %] - [% IF header_row.$place.cell == 'itemnumber' %] + [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %] [% SET batch_itemnumbers = 1 %] [% END %] @@ -780,7 +780,7 @@ canned reports and writing custom SQL reports.

[% FOREACH result IN results %] [% FOREACH cells IN result.cells %] [% place = loop.index %] - [% IF header_row.$place.cell == 'biblionumber' %] + [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %] [% SET batch_biblionumbers = 1 %] [% END %] @@ -791,7 +791,7 @@ canned reports and writing custom SQL reports.

[% # Preserve the whitespace of the following textarea in order to format the values correctly %] -
@@ -804,7 +804,7 @@ canned reports and writing custom SQL reports.