Bug 42740: Fix suggestion status when editing

To test:
1. Make a purchase suggestion.
2. Set the status to something, anything.
3. Edit that suggestion, notice that the "Status:" is set to 'No Status'
4. Now when you save, they actual status is lost.
5. APPLY PATCH, restart_all
6. Try steps 1 - 3. This time at step 3 the suggestion status should be properly set.
7. Save the suggestion, make sure it saves with the correct status.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Lucas Gass 2026-06-01 20:47:00 +00:00 committed by Pedro Amorim
parent d1476c8184
commit 86b2eb9a3a
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 5 additions and 4 deletions

View File

@ -549,11 +549,12 @@ foreach my $r ( @{$sugg_budgets} ) {
@{$sugg_budget_loop} = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$sugg_budget_loop};
$template->param( sugg_budgets => $sugg_budget_loop );
if ( $suggestion_ref->{STATUS} ) {
if ( $stored_suggestion && $stored_suggestion->STATUS ) {
$template->param(
"statusselected_" . $suggestion_ref->{STATUS} => 1,
selected_status => $suggestion_ref->{STATUS}
, # We need template var selected_status in the second part of the template where template var suggestion.STATUS is out of scope
"statusselected_" . $stored_suggestion->STATUS => 1,
selected_status => $stored_suggestion->STATUS,
# We need template var selected_status in the second part of the template where template var suggestion.STATUS is out of scope
);
}