Bug 37797

Summary: Choosing not to delete a budget does not need to be a form submission
Product: Koha Reporter: Emily Lamancusa (emlam) <emily.lamancusa>
Component: Architecture, internals, and plumbingAssignee: Emily Lamancusa (emlam) <emily.lamancusa>
Status: RESOLVED FIXED QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: chloe.zermatten, lucas, martin.renvoize, phil
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on:    
Bug Blocks: 37728    
Attachments: Bug 37797: Change cancel button to a link styled as a button
Bug 37797: Change cancel button to a link styled as a button
Bug 37797: Change cancel button to a link styled as a button

Description Emily Lamancusa (emlam) 2024-08-30 20:41:51 UTC
On the confirmation page for deleting a budget, if the user selects "cancel", they are choosing not to perform an update. Currently the button is triggering a form POST with no op, but it really just needs to be a link back to the budget administration page.
Comment 1 Emily Lamancusa (emlam) 2024-08-30 20:57:31 UTC
Created attachment 170928 [details] [review]
Bug 37797: Change cancel button to a link styled as a button

On the confirmation page for deleting a budget, change "Do not delete"
from a form submission to a link (styled to look like a button) in order
to avoid errors from POSTing with no op.

To test:
1. Go to Acquisitions > Budgets
2. Create a test budget
3. Attempt to delete the test budget
4. On the confirmation page, click "No, don't delete"
--> An error appears saying that the form was POSTed with no op!
5. Apply patch
6. Repeat steps 3-4
--> You are linked back to the Budgets page. The budget was not deleted.
Comment 2 Phil Ringnalda 2024-08-30 22:11:12 UTC
Interesting bustage, that the before state, which is supposed to be a POST without an op, was actually a POST with the wrong op. We have templates that set     $template->param(script_name=> to a string containing their actual path, but this one doesn't, so the template var script_name was apparently getting the path from the page's URL through some magic. Bet that's a whole new class of bug 36192 bustage we haven't yet noticed, where a script that was only getting POSTs now also gets GETs, and doesn't set script_name, and has a template that uses script_name.
Comment 3 Phil Ringnalda 2024-08-31 17:53:01 UTC
Oh, no magic, script_name isn't set so it's action="", which is the current page with its query string.
Comment 4 Chloe Zermatten 2024-09-03 11:02:41 UTC
Created attachment 170977 [details] [review]
Bug 37797: Change cancel button to a link styled as a button

On the confirmation page for deleting a budget, change "Do not delete"
from a form submission to a link (styled to look like a button) in order
to avoid errors from POSTing with no op.

To test:
1. Go to Acquisitions > Budgets
2. Create a test budget
3. Attempt to delete the test budget
4. On the confirmation page, click "No, don't delete"
--> An error appears saying that the form was POSTed with no op!
5. Apply patch
6. Repeat steps 3-4
--> You are linked back to the Budgets page. The budget was not deleted.

Signed-off-by: Chloe Zermatten <chloe.zermatten@ptfs-europe.com>
Comment 5 Phil Ringnalda 2024-09-04 01:46:55 UTC
Filed bug 37826 for the unset script_name problem.
Comment 6 Martin Renvoize (ashimema) 2024-09-13 12:01:55 UTC
Created attachment 171452 [details] [review]
Bug 37797: Change cancel button to a link styled as a button

On the confirmation page for deleting a budget, change "Do not delete"
from a form submission to a link (styled to look like a button) in order
to avoid errors from POSTing with no op.

To test:
1. Go to Acquisitions > Budgets
2. Create a test budget
3. Attempt to delete the test budget
4. On the confirmation page, click "No, don't delete"
--> An error appears saying that the form was POSTed with no op!
5. Apply patch
6. Repeat steps 3-4
--> You are linked back to the Budgets page. The budget was not deleted.

Signed-off-by: Chloe Zermatten <chloe.zermatten@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Katrin Fischer 2024-09-13 14:12:02 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 8 Lucas Gass (lukeg) 2024-11-18 16:09:34 UTC
Doesnt apply to 24.05.x, no backport.