diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index ed3a19bcfd..154b2e845c 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -251,12 +251,18 @@ sub ModSuggestion { return unless ( $suggestion and defined( $suggestion->{suggestionid} ) ); my $suggestion_object = Koha::Suggestions->find( $suggestion->{suggestionid} ); + my $previous_suggestion_status; + $previous_suggestion_status = $suggestion_object->STATUS if $suggestion_object; eval { # FIXME Must raise an exception instead $suggestion_object->set($suggestion)->store; }; return 0 if $@; - if ( $suggestion->{STATUS} && $suggestion_object->suggestedby ) { + # now send a notification but only if STATUS has been changed + if ( $suggestion->{STATUS} + && $suggestion->{STATUS} ne $previous_suggestion_status + && $suggestion_object->suggestedby ) + { # fetch the entire updated suggestion so that we can populate the letter my $full_suggestion = GetSuggestion( $suggestion->{suggestionid} );