Bug 40870

Summary: Fund code is lost when modifying an order in acquisitions
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: AcquisitionsAssignee: Lucas Gass (lukeg) <lucas>
Status: Pushed to stable --- QA Contact: Matt Blenkinsop <matt.blenkinsop>
Severity: major    
Priority: P5 - low CC: jonathan.druart, lucas, matt.blenkinsop, tomascohen
Version: Main   
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:
25.11.00,25.05.04
Circulation function:
Bug Depends on: 38714    
Bug Blocks:    
Attachments: Bug 40870: Set the fund code to selected on acqui/neworderempty.pl
Bug 40870: Set the fund code to selected on acqui/neworderempty.pl
Bug 40870: Set the fund code to selected on acqui/neworderempty.pl
Bug 40870: Set selected when needed
Bug 40870: Set selected when needed
Bug 40870: Set selected when needed

Description Andrew Fuerste-Henry 2025-09-24 13:05:47 UTC
To recreate:
- add an order to a basket in acquisitions
- confirm your order shows in the basket with a fund code selected
- click Modify on your order
- note that Fund is empty in the modify form and you need to re-select it
Comment 1 Lucas Gass (lukeg) 2025-09-24 14:03:51 UTC
It doesn't seem like we are trying to set the fund at all in the dropdown to 'selected'.
Comment 2 Lucas Gass (lukeg) 2025-09-24 14:22:40 UTC
Created attachment 186884 [details] [review]
Bug 40870: Set the fund code to selected on acqui/neworderempty.pl

To tes:
1- add an order to a basket in acquisitions
2- confirm your order shows in the basket with a fund code selected
3- click Modify on your order
4- note that Fund is empty in the modify form and you need to re-select it
5. APPLY PATCH
6. Try steps 1 -4 again, the correct fund should be set on page load
Comment 3 Andrew Fuerste-Henry 2025-09-24 14:52:19 UTC
Created attachment 186888 [details] [review]
Bug 40870: Set the fund code to selected on acqui/neworderempty.pl

To tes:
1- add an order to a basket in acquisitions
2- confirm your order shows in the basket with a fund code selected
3- click Modify on your order
4- note that Fund is empty in the modify form and you need to re-select it
5. APPLY PATCH
6. Try steps 1 -4 again, the correct fund should be set on page load

Signed-off-by: Wendy Bartlett <wbartlett@cuyahogalibrary.org>
Comment 4 Matt Blenkinsop 2025-09-24 15:12:02 UTC
Created attachment 186895 [details] [review]
Bug 40870: Set the fund code to selected on acqui/neworderempty.pl

To tes:
1- add an order to a basket in acquisitions
2- confirm your order shows in the basket with a fund code selected
3- click Modify on your order
4- note that Fund is empty in the modify form and you need to re-select it
5. APPLY PATCH
6. Try steps 1 -4 again, the correct fund should be set on page load

Signed-off-by: Wendy Bartlett <wbartlett@cuyahogalibrary.org>
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Comment 5 Lucas Gass (lukeg) 2025-09-24 15:27:08 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 6 Jonathan Druart 2025-09-25 09:42:16 UTC
Created attachment 186908 [details] [review]
Bug 40870: Set selected when needed

I think this commit simplifies the code a lot.
The regression has been caused by
  commit fe4999ad39a33476fdcf886648e1e52b5947ab04
  Bug 38714: acqui/neworderempty.tt

It forgot to set the selected attribute.
Comment 7 Jonathan Druart 2025-09-25 09:42:50 UTC
Could you have a look at this patch please? I think it's a cleaner way to fix the bug.
Comment 8 Jonathan Druart 2025-09-25 09:45:07 UTC
Created attachment 186909 [details] [review]
Bug 40870: Set selected when needed

I think this commit simplifies the code a lot.
The regression has been caused by
  commit fe4999ad39a33476fdcf886648e1e52b5947ab04
  Bug 38714: acqui/neworderempty.tt

It forgot to set the selected attribute.
Comment 9 Lucas Gass (lukeg) 2025-09-25 13:04:01 UTC
(In reply to Jonathan Druart from comment #7)
> Could you have a look at this patch please? I think it's a cleaner way to
> fix the bug.

Yes, it's much cleaner.
Comment 10 Lucas Gass (lukeg) 2025-09-25 13:48:19 UTC
Created attachment 186921 [details] [review]
Bug 40870: Set selected when needed

I think this commit simplifies the code a lot.
The regression has been caused by
  commit fe4999ad39a33476fdcf886648e1e52b5947ab04
  Bug 38714: acqui/neworderempty.tt

It forgot to set the selected attribute.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 11 Paul Derscheid 2025-09-25 16:31:37 UTC
Nice work everyone!

Pushed to 25.05.x