Bug 37382 - Report download is empty except for headers if .tab format is selected
Summary: Report download is empty except for headers if .tab format is selected
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: CJ Lynce
QA Contact: Lucas Gass (lukeg)
URL:
Keywords:
Depends on: 5920
Blocks:
  Show dependency treegraph
 
Reported: 2024-07-16 20:15 UTC by Eric Swenson
Modified: 2024-10-09 21:27 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00,24.05.04
Circulation function:


Attachments
Bug 37382: Report download is empty except for headers if .tab format is selected (2.02 KB, patch)
2024-07-26 18:58 UTC, CJ Lynce
Details | Diff | Splinter Review
Bug 37382: Report download is empty except for headers if .tab format is selected (2.08 KB, patch)
2024-07-26 19:32 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 37382: Report download is empty except for headers if .tab format is selected (2.13 KB, patch)
2024-08-13 15:52 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Swenson 2024-07-16 20:15:36 UTC
Run a report and select download as tab separated text. The downloaded file will have the first row and then empty rows for the number of results that should have been returned.
Comment 1 CJ Lynce 2024-07-26 18:57:52 UTC
I found that this issue also causes a ton of misc files to be created on the server filesystem in koha/reports/ . Each file is named something related to the exported data. 

Example
-rw-r--r--  1 kohadev-koha kohadev-koha   14 Jul 26 18:42 'Conspirator :'
-rw-r--r--  1 kohadev-koha kohadev-koha   14 Jul 26 18:42 'CSS :'
-rw-r--r--  1 kohadev-koha kohadev-koha   14 Jul 26 18:42 'Damned to fame :'
Comment 2 CJ Lynce 2024-07-26 18:58:33 UTC
Created attachment 169776 [details] [review]
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.
Comment 3 ByWater Sandboxes 2024-07-26 19:32:35 UTC
Created attachment 169780 [details] [review]
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 <laura@bywatersolutions.com>
Comment 4 Laura O'Neil 2024-07-26 19:35:20 UTC
I was unable to confirm the second issue of misc files created in koha/reports, but the patch fixes the data issue.
Comment 5 Lucas Gass (lukeg) 2024-08-13 15:52:29 UTC
Created attachment 170267 [details] [review]
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 <laura@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 6 Katrin Fischer 2024-08-16 15:37:10 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 7 Lucas Gass (lukeg) 2024-09-06 16:34:03 UTC
Backported to 24.05.x for upcoming 24.05.04
Comment 8 Fridolin Somers 2024-09-17 14:02:29 UTC
Depends on Bug 5920 not in 23.11.x