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 <wizzyrea@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2019-05-14 12:23:25 -05:00 committed by root
parent 9613d9f164
commit 39c4d9d55e
1 changed files with 3 additions and 4 deletions

View File

@ -544,11 +544,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} ) {
@ -584,7 +583,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