From 17ebb9f6fc51ddffa5336e1314ff442fe0a168b8 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 --- 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.11.0