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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 2c73648f77)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2023-07-05 15:44:50 +02:00 committed by Martin Renvoize
parent 5f6f595af5
commit 741f711d5e
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -140,6 +140,7 @@ sub prep_report {
{ #The placeholders are always the odd elements of the array
my ( $type, $name ) = split /\|/,
$split[ $i * 2 + 1 ]; # We split them on '|'
$name =~ s/^\s+|\s+$//; # Trim
$headers->{$name} = $type; # Store as a lookup for the template
$headers->{$name} =~
s/^\w*\.//; # strip the table name just as in $sth->{NAME} array