From 52e1104e684247dd35624a22869877a424eb79e3 Mon Sep 17 00:00:00 2001
From: Jonathan Druart
Date: Thu, 26 Dec 2019 11:11:55 +0100
Subject: [PATCH] Bug 24305: Fix links to batch tools when report's columns do
not contain integers
Content-Type: text/plain; charset=utf-8
If report's columns do not only contain integers, we should not point to
batch tools.
For instance, if the value is a link, the batch tools will not work as
they will not retrieve the id (itemnnumber or biblionumber) properly
Test plan:
Create a report like:
SELECT CONCAT('', itemnumber, '' ) AS itemnumber
FROM items
LIMIT 10;
Execute it
=> There is not link to the batch tools
Edit the report like:
SELECT itemnumber
FROM items
LIMIT 10;
Execute it
=> There is a link to the batch tools
Edit the report like
SELECT itemnumber, CONCAT('', itemnumber, '' ) AS itemnumber
FROM items
LIMIT 10;
Execute it
=> There is link to the batch tools
Try other combinations with biblionumber.
Signed-off-by: Marcel de Rooy
---
.../prog/en/modules/reports/guided_reports_start.tt | 10 ++++++++--
1 file changed, 8 insertions(+), 2 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 4ca5833a52..95964dac69 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
@@ -755,8 +755,10 @@ canned reports and writing custom SQL reports.
[% FOREACH result IN results %]
[% FOREACH cells IN result.cells %]
[% place = loop.index %]
+ [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
[% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
[% SET batch_itemnumbers = 1 %]
+ [% SET header_row.$place.has_itemnumbers = 1 %]
[% END %]
[% END %]
@@ -769,8 +771,10 @@ canned reports and writing custom SQL reports.
[% FOREACH result IN results %]
[% FOREACH cells IN result.cells %]
[% place = loop.index %]
+ [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
[% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
[% SET batch_itemnumbers = 1 %]
+ [% SET header_row.$place.has_itemnumbers = 1 %]
[% END %]
[% END %]
@@ -781,8 +785,10 @@ canned reports and writing custom SQL reports.
[% FOREACH result IN results %]
[% FOREACH cells IN result.cells %]
[% place = loop.index %]
+ [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
[% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
[% SET batch_biblionumbers = 1 %]
+ [% SET header_row.$place.has_biblionumbers = 1 %]
[% END %]
[% END %]
@@ -805,7 +811,7 @@ canned reports and writing custom SQL reports.