From 2ed7ecc7ee274f59ebf4dc81e85f0d78a3d5dc99 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 14 May 2019 12:23:25 -0500 Subject: [PATCH] Bug 22908: Prevent ModSuggestion to send a notice if something wrong happened There is a return value $status_update_table that is set to 0, then we send the alert (whatever the value of this variable). We must return earlier if something happened! Test plan: Not sure how to recreate it via the interface, so just run the tests? Signed-off-by: Liz Rea Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens (cherry picked from commit 39c4d9d55e5a2e137adbbbd2b29b5b829f66b59e) Signed-off-by: Martin Renvoize --- C4/Suggestions.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 70b7b0de02..42be6f3add 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -492,11 +492,10 @@ sub ModSuggestion { } my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid}); - my $status_update_table = 1; - eval { + eval { # FIXME Must raise an exception instead $rs->update($suggestion); }; - $status_update_table = 0 if( $@ ); + return 0 if $@; if ( $suggestion->{STATUS} ) { @@ -529,7 +528,7 @@ sub ModSuggestion { ) or warn "can't enqueue letter $letter"; } } - return $status_update_table; + return 1; # No useful if the exception is raised earlier } =head2 ConnectSuggestionAndBiblio -- 2.39.2