Bug 37411

Summary: Exporting budget planning gives 500 error
Product: Koha Reporter: Sara Brown <sbrown>
Component: AcquisitionsAssignee: Eric Garcia <cubingguy714>
Status: Pushed to oldstable --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: cubingguy714, fridolin.somers, lucas, martin.renvoize, roman.dolny, wainuiwitikapark
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: 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,23.11.09
Circulation function:
Attachments: Bug 37411: Fixed 500 error when exporting budget planning
Bug 37411: Fixed exporting to csv file
Bug 37411: Fixed 500 error when exporting budget planning
Bug 37411: Fixed exporting to csv file
Bug 37411: Fixed 500 error when exporting budget planning
Bug 37411: Fixed exporting to csv file

Description Sara Brown 2024-07-18 21:14:57 UTC
If I try to export to CSV from aqplan.pl (Acquisitions > Budgets > Funds > Planning), I get a 500 error. This is happening in 23.05.10, 23.05.11, and 24.05, and whether I'm planning the budget by months, libraries, or item types.
Comment 1 Eric Garcia 2024-07-29 15:27:18 UTC
Created attachment 169847 [details] [review]
Bug 37411: Fixed 500 error when exporting budget planning

To test:
1. Acquistions -> Budgets -> Funds -> Planning, select any option
2. In the toolbar see Export, and click Submit and see a 500 error
3. Apply patch, restart_all
4. Repeat steps 1-2
5. Notice the 500 error is gone and the CSV is exported properly

Notes:
Is there a reason we call exit(1) after exporting the csv?
Comment 2 Roman Dolny 2024-07-29 16:49:01 UTC
After applying a patch problem with 500 error is gone.

However, the CSV file is not exported correctly - it contains not only budget data but also HTML page generated by output_html_with_http_headers:

Status: 200 OK
Set-Cookie: CGISESSID=b23f65baf79e7d7752b6cea526a6fd69; path=/; HttpOnly; SameSite=Lax
Date: Mon, 29 Jul 2024 16:29:20 GMT
Cache-control: no-cache
Content-script-type: text/javascript
Content-style-type: text/css
Pragma: no-cache
X-frame-options: SAMEORIGIN
Content-Type: text/html; charset=UTF-8

<!DOCTYPE html>
<!-- TEMPLATE FILE: aqplan.tt -->
<html lang="en">
<head>
...
Comment 3 Eric Garcia 2024-07-31 18:34:13 UTC
Created attachment 169910 [details] [review]
Bug 37411: Fixed exporting to csv file

To test:
1. Acquistions -> Budgets -> Funds -> Planning, select any option
2. In the toolbar see Export, and click Submit and see a 500 error
3. Apply patch, restart_all
4. Repeat steps 1-2
5. Notice the 500 error is gone and the CSV is exported properly
Comment 4 Roman Dolny 2024-07-31 19:04:46 UTC
Created attachment 169912 [details] [review]
Bug 37411: Fixed 500 error when exporting budget planning

To test:
1. Acquistions -> Budgets -> Funds -> Planning, select any option
2. In the toolbar see Export, and click Submit and see a 500 error
3. Apply patch, restart_all
4. Repeat steps 1-2
5. Notice the 500 error is gone and the CSV is exported properly

Notes:
Is there a reason we call exit(1) after exporting the csv?

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 5 Roman Dolny 2024-07-31 19:04:48 UTC
Created attachment 169913 [details] [review]
Bug 37411: Fixed exporting to csv file

To test:
1. Acquistions -> Budgets -> Funds -> Planning, select any option
2. In the toolbar see Export, and click Submit and see a 500 error
3. Apply patch, restart_all
4. Repeat steps 1-2
5. Notice the 500 error is gone and the CSV is exported properly

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 6 Martin Renvoize (ashimema) 2024-08-01 11:03:39 UTC
Created attachment 169936 [details] [review]
Bug 37411: Fixed 500 error when exporting budget planning

To test:
1. Acquistions -> Budgets -> Funds -> Planning, select any option
2. In the toolbar see Export, and click Submit and see a 500 error
3. Apply patch, restart_all
4. Repeat steps 1-2
5. Notice the 500 error is gone and the CSV is exported properly

Notes:
Is there a reason we call exit(1) after exporting the csv?

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize (ashimema) 2024-08-01 11:03:42 UTC
Created attachment 169937 [details] [review]
Bug 37411: Fixed exporting to csv file

To test:
1. Acquistions -> Budgets -> Funds -> Planning, select any option
2. In the toolbar see Export, and click Submit and see a 500 error
3. Apply patch, restart_all
4. Repeat steps 1-2
5. Notice the 500 error is gone and the CSV is exported properly

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Katrin Fischer 2024-08-01 16:27:27 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 9 Lucas Gass (lukeg) 2024-08-29 17:34:02 UTC
Backported to 24.05.x for upcoming 24.05.04
Comment 10 Fridolin Somers 2024-09-17 13:40:36 UTC
Pushed to 23.11.x for 23.11.09
Comment 11 Wainui Witika-Park 2024-09-18 06:42:20 UTC
Not backporting to 23.05.x unless requested