Bug 27824

Summary: Report batch operations break with space in placeholder
Product: Koha Reporter: Owen Leonard <oleonard>
Component: ReportsAssignee: Jonathan Druart <jonathan.druart>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: jonathan.druart
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.02,22.11.08
Circulation function:
Bug Depends on: 23390    
Bug Blocks:    
Attachments: Bug 27824: Add a test
Bug 27824: Trim column headers
Bug 27824: Add a test
Bug 27824: Trim column headers
Bug 27824: Add a test
Bug 27824: Trim column headers

Description Owen Leonard 2021-03-01 16:12:16 UTC
I found this bug while testing Bug 5697:

Using the system for defining a column name placeholder (Bug 23390), if there is a space inside the column name placeholder it won't work. The SQL example in Bug 5697:

SELECT 
i.itemnumber,
i.itemnumber as Exemplarnummber,
[[i.itemnumber| itemnumber for batch]],
CONCAT('<a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=', i.biblionumber, '&itemnumber=', i.itemnumber, '#edititem', '\">', i.itemnumber, '</a>' ) AS "itemnumber as edit link"
FROM items i

"[[i.itemnumber| itemnumber for batch]]" has a space before "itemnumber for batch." With that space removed it works as expected.
Comment 1 Jonathan Druart 2021-03-02 14:09:02 UTC
What does not work exactly?
I copy/pasted the query to create a new SQL report, I run it and see the table result with the 4 headers: itemnumber, Exemplarnummber,	itemnumber for batch, itemnumber as edit link
Comment 2 Katrin Fischer 2023-07-01 17:34:24 UTC
(In reply to Jonathan Druart from comment #1)
> What does not work exactly?
> I copy/pasted the query to create a new SQL report, I run it and see the
> table result with the 4 headers: itemnumber, Exemplarnummber,	itemnumber for
> batch, itemnumber as edit link

The third column should look like the first - linked to actions. But it doesn't work.
Comment 3 Jonathan Druart 2023-07-05 13:45:36 UTC
Created attachment 153059 [details] [review]
Bug 27824: Add a test
Comment 4 Jonathan Druart 2023-07-05 13:45:39 UTC
Created attachment 153060 [details] [review]
Bug 27824: Trim column headers

To support additional spaces.

Using the system for defining a column name placeholder (Bug 23390), if there is a space inside the column name placeholder it won't work. The SQL example in Bug 5697:

SELECT
i.itemnumber,
i.itemnumber as Exemplarnummber,
[[i.itemnumber| itemnumber for batch]],
CONCAT('<a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=', i.biblionumber, '&itemnumber=', i.itemnumber, '#edititem', '\">', i.itemnumber, '</a>' ) AS "itemnumber as edit link"
FROM items i

"[[i.itemnumber| itemnumber for batch]]" has a space before "itemnumber for batch." With that space removed it works as expected.
Comment 5 Owen Leonard 2023-07-05 15:49:27 UTC
Created attachment 153064 [details] [review]
Bug 27824: Add a test

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 6 Owen Leonard 2023-07-05 15:49:29 UTC
Created attachment 153065 [details] [review]
Bug 27824: Trim column headers

To support additional spaces.

Using the system for defining a column name placeholder (Bug 23390), if
there is a space inside the column name placeholder it won't work. The
SQL example in Bug 5697:

SELECT
i.itemnumber,
i.itemnumber as Exemplarnummber,
[[i.itemnumber| itemnumber for batch]],
CONCAT('<a
href=\"/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=',
i.biblionumber, '&itemnumber=', i.itemnumber, '#edititem', '\">',
i.itemnumber, '</a>' ) AS "itemnumber as edit link"
FROM items i

"[[i.itemnumber| itemnumber for batch]]" has a space before "itemnumber
for batch." With that space removed it works as expected.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 7 Katrin Fischer 2023-07-09 14:15:11 UTC
Created attachment 153220 [details] [review]
Bug 27824: Add a test

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2023-07-09 14:15:14 UTC
Created attachment 153221 [details] [review]
Bug 27824: Trim column headers

To support additional spaces.

Using the system for defining a column name placeholder (Bug 23390), if
there is a space inside the column name placeholder it won't work. The
SQL example in Bug 5697:

SELECT
i.itemnumber,
i.itemnumber as Exemplarnummber,
[[i.itemnumber| itemnumber for batch]],
CONCAT('<a
href=\"/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=',
i.biblionumber, '&itemnumber=', i.itemnumber, '#edititem', '\">',
i.itemnumber, '</a>' ) AS "itemnumber as edit link"
FROM items i

"[[i.itemnumber| itemnumber for batch]]" has a space before "itemnumber
for batch." With that space removed it works as expected.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Tomás Cohen Arazi (tcohen) 2023-07-13 18:21:17 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 10 Martin Renvoize (ashimema) 2023-07-18 11:51:53 UTC
Thanks for all the hard work!

Pushed to 23.05.x for the next release
Comment 11 Matt Blenkinsop 2023-07-18 14:23:38 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x