Lines 251-262
sub ModSuggestion {
Link Here
|
251 |
return unless ( $suggestion and defined( $suggestion->{suggestionid} ) ); |
251 |
return unless ( $suggestion and defined( $suggestion->{suggestionid} ) ); |
252 |
|
252 |
|
253 |
my $suggestion_object = Koha::Suggestions->find( $suggestion->{suggestionid} ); |
253 |
my $suggestion_object = Koha::Suggestions->find( $suggestion->{suggestionid} ); |
|
|
254 |
my $previous_suggestion_status; |
255 |
$previous_suggestion_status = $suggestion_object->STATUS if $suggestion_object; |
254 |
eval { # FIXME Must raise an exception instead |
256 |
eval { # FIXME Must raise an exception instead |
255 |
$suggestion_object->set($suggestion)->store; |
257 |
$suggestion_object->set($suggestion)->store; |
256 |
}; |
258 |
}; |
257 |
return 0 if $@; |
259 |
return 0 if $@; |
258 |
|
260 |
|
259 |
if ( $suggestion->{STATUS} && $suggestion_object->suggestedby ) { |
261 |
# now send a notification but only if STATUS has been changed |
|
|
262 |
if ( $suggestion->{STATUS} |
263 |
&& $suggestion->{STATUS} ne $previous_suggestion_status |
264 |
&& $suggestion_object->suggestedby ) |
265 |
{ |
260 |
|
266 |
|
261 |
# fetch the entire updated suggestion so that we can populate the letter |
267 |
# fetch the entire updated suggestion so that we can populate the letter |
262 |
my $full_suggestion = GetSuggestion( $suggestion->{suggestionid} ); |
268 |
my $full_suggestion = GetSuggestion( $suggestion->{suggestionid} ); |
263 |
- |
|
|