From 7d0563e1c568609559dab399535641e167a0795c Mon Sep 17 00:00:00 2001 From: CJ Lynce Date: Fri, 26 Jul 2024 18:53:37 +0000 Subject: [PATCH] Bug 37382: Report download is empty except for headers if .tab format is selected When exporting a report in tab delimited format, the downloaded file would have the header rows but no data results. Also, misc files are created on the server file system in koha/reports with data that should have been in the .tab file. This patch fixes both of these issues. To test: 1. Login to staff client 2. Go to Reports and create a report from SQL - sample report SELECT i.barcode, b.title, b.biblionumber, i.itemnumber FROM items i LEFT JOIN biblio b on i.biblionumber = b.biblionumber WHERE i.itemnumber < 50 3. Run the report 4. Click 'Download'->'Tab separated text' 5. Download file 6. Open file in a text editor or favorite spreadsheet app File will have headers rows, but no other item data 6a. If able, check the server filesystem in koha/reports There may be files there related to report data. Remove. 7. Apply Patch 8. Repeat steps 3-6, File will now have the table data, hooray! 8a. If able, check the server filesystem in koha/reports No new files should be created. Signed-off-by: Laura ONeil Signed-off-by: Lucas Gass Signed-off-by: Katrin Fischer --- reports/guided_reports.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index b85b36a860..e2dfe41268 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -633,7 +633,8 @@ elsif ($op eq 'export'){ $content .= join("\t", header_cell_values($sth)) . "\n"; $content = $scrubber->scrub( Encode::decode( 'UTF-8', $content ) ); while ( my $row = $sth->fetchrow_arrayref() ) { - $content .= join( "\t", $scrubber->scrub(@$row) ) . "\n"; + $content .= join( "\t", map { $_ // '' } @$row ) . "\n"; + $content = $scrubber->scrub( $content ); } } else { if ( $format eq 'csv' ) { -- 2.39.5