Bugzilla – Attachment 173199 Details for
Bug 38235
Suggestion confirmation letter sent when it should not
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38235: Suggestion confirmation letter sent when it should not
Bug-38235-Suggestion-confirmation-letter-sent-when.patch (text/plain), 2.82 KB, created by
Janusz Kaczmarek
on 2024-10-23 10:08:40 UTC
(
hide
)
Description:
Bug 38235: Suggestion confirmation letter sent when it should not
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2024-10-23 10:08:40 UTC
Size:
2.82 KB
patch
obsolete
>From 867dfe185949e7540d3a63c5f7ce635467751868 Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Tue, 22 Oct 2024 11:00:09 +0000 >Subject: [PATCH] Bug 38235: Suggestion confirmation letter sent when it should > not > >When processing a new order (creating basket, receiving order, etc.) >using a bibliographic record once already linked to an old >suggestion (already completed in the past), Koha generates and sends >a confirmation letter that should not be sent at all. > >This is because suggestions in Koha are linked to a biblionumber (and >not the order), and so the old suggestion is identified - erroneously - >as relevant. Then C4::Suggestions::ModSuggestion sends a letter >whenever it receives STATUS as a parameter, paying no attention to >whether the status is changed. So, in this case, a suggestion already >in the status AVAILABLE is "updated" to the status AVAILABLE and the >letter is generated. To solve this problem, it should be enough to >check whether STATUS is actually changed. > >Test plan: >========== > >1. As a patron, make a purchase suggestion. As a librarian, accept it and > process it, as usual, through the acquisition process. >2. At the patron account, as librarian, check the generated notices (the > most recent should be "Suggested purchase available"). >3. Make a new aquisition order for the same bibliographic record > ("From an existing record:") and receive it as usual. >4. Go to the account of the patron that made the original suggestion and > check the notices. Note the second, irrelevant letter "Suggested > purchase available". >5. Apply the patch; restart_all. >6. Repeat p. 3 and 4. Note that no new notice has been generated. > >Sponsored-by: Ignatianum University in Cracow >--- > C4/Suggestions.pm | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > >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} ); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38235
:
173199
|
173200
|
173227
|
173228
|
174391
|
174392