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 <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2019-12-13 19:58:52 +00:00 committed by Martin Renvoize
parent 611cb46189
commit ee4d99cc76
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 2 additions and 0 deletions

View File

@ -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;