Bug 10227 - GetMessagingPreferences does not return correct Digest preferences
Summary: GetMessagingPreferences does not return correct Digest preferences
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Sophie MEYNIEUX
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-10 15:40 UTC by Sophie MEYNIEUX
Modified: 2017-12-07 22:16 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 10227 : Fix GetMessagingPreferences when digest is possible (944 bytes, patch)
2016-08-24 13:01 UTC, Sophie MEYNIEUX
Details | Diff | Splinter Review
Bug 10227 : Fix GetMessagingPreferences when digest is possible (1.73 KB, patch)
2016-09-09 01:06 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 10227 : Fix GetMessagingPreferences when digest is possible (1.80 KB, patch)
2016-09-12 17:01 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Sophie MEYNIEUX 2013-05-10 15:40:50 UTC
SQL request in GetMessaginPreferences does not join on digest value, so, for a given patron, if you request his messaging preferences for a given message, it  returns 2 rows, one with digest=On and the other with digest=Off rather than juste one corresponding to the Digest preference of the patron.
Comment 1 Sophie MEYNIEUX 2016-08-24 13:01:15 UTC Comment hidden (obsolete)
Comment 2 Sophie MEYNIEUX 2016-08-24 13:22:16 UTC
This bug is a bit tricky to test, as the result is somehow  random, depending on the order of rows returned by sql request. You've got to change the preferences several times to see bad results.

Enable EnhancedMessaging preferences
Set preferences for a borrower or a category. 
run misc/cronjobs/advance_notices.pl and look in message_queue table the letter_code of the generated messages.
Change digest selection and do the test again several times 

Without patch, for message where digest is allowed (Advance_Notice, Item_Due), for a borrower or a category with 'wants_digest' selected, GetBorrowerMessagingPreferences returns sometimes letter_code with DGST and sometimes not.

With the patch, letter_code returned is always correct depending on digest selected or not
Comment 3 Chris Cormack 2016-09-09 01:06:32 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2016-09-12 17:01:37 UTC
Created attachment 55513 [details] [review]
Bug 10227 : Fix GetMessagingPreferences when digest is possible

This bug is a bit tricky to test, as the result is somehow  random, depending on the order of rows returned by sql request. You've got to change the preferences several times to see bad results.

Enable EnhancedMessaging preferences
Set preferences for a borrower or a category.
run misc/cronjobs/advance_notices.pl and look in message_queue table the letter_code of the generated messages.
Change digest selection and do the test again several times

Without patch, for message where digest is allowed (Advance_Notice, Item_Due), for a borrower or a category with 'wants_digest' selected, GetBorrowerMessagingPreferences returns sometimes letter_code with DGST and sometimes not.

With the patch, letter_code returned is always correct depending on digest selected or not

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Kyle M Hall 2016-09-13 18:17:19 UTC
Pushed to master for 16.11, thanks Sophie!