From ee4d99cc76a79ad11c1b0a2b096abb2f9b85bf0e Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 13 Dec 2019 19:58:52 +0000 Subject: [PATCH] Bug 24244: Send null instead of empty string if branch not set Fix NewSuggestion if branchcode is passed with an empty string. Error was "Broken FK constraint" Test plan: Create a new suggestion, select "any" for the library. Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- C4/Suggestions.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 764c331752..836b13fc42 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -448,6 +448,8 @@ sub NewSuggestion { $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate}; + delete $suggestion->{branchcode} if $suggestion->{branchcode} eq ''; + my $suggestion_object = Koha::Suggestion->new( $suggestion )->store; my $suggestion_id = $suggestion_object->suggestionid; -- 2.39.5