From 8f521bdb3c29ef8a54668c15fa936b5b963079eb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 17 Apr 2024 11:48:16 +0200 Subject: [PATCH] Bug 34963: Restore the ability to blank fields when editing a suggestion Regression introduced by bug 23991. We don't want to remove the fields from the edition if they are empty. Ideally we should have separate parameters for edition and search, but this is the low-effort fix, and hopefully won't introduce side-effects. Test plan: Try to edit a suggestion and blank some fields Try to search for suggestions using the search form on the left of the screen Signed-off-by: Ray Delahunty Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer (cherry picked from commit cd1f4145fe091314895a4f8a4f73a5b3a5f8bb87) Signed-off-by: Fridolin Somers (cherry picked from commit e6a2b1afde992359d0a0ad860701838438a9ebaf) Signed-off-by: Lucas Gass --- suggestion/suggestion.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 4b00fa0056..0113b3b4cd 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -116,8 +116,11 @@ foreach (keys %$suggestion_ref){ } delete $suggestion_only->{branchcode} if $suggestion_only->{branchcode} eq '__ANY__'; delete $suggestion_only->{budgetid} if $suggestion_only->{budgetid} eq '__ANY__'; -while ( my ( $k, $v ) = each %$suggestion_only ) { - delete $suggestion_only->{$k} if $v eq ''; + +unless ( $op eq 'save' ) { + while ( my ( $k, $v ) = each %$suggestion_only ) { + delete $suggestion_only->{$k} if $v eq ''; + } } my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user( -- 2.39.5