Bug 12315

Summary: MTT FIX: Advanced notices are duplicated and not sent to the right patron
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: ToolsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Galen Charlton <gmcharlt>
Severity: critical    
Priority: P5 - low CC: bgkriegel, fridolin.somers, gmcharlt, olli-antti.kivilahti, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12396
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 10833    
Bug Blocks:    
Attachments: Bug 12315: Advanced notices are duplicated and not sent to the right patron
[SIGNED-OFF] Bug 12315: Advanced notices are duplicated and not sent to the right patron
Bug 12315: fix sending of duplicate advanced notices (and sending advanced notices to wrong patron)

Description Jonathan Druart 2014-05-27 08:10:08 UTC
Bug 10833 introduced a variable loop but does not reset it every iteration.
So the first patron receives correct letters, but the followings received all the previous ones AND his letters.
Very bad...
Comment 1 Jonathan Druart 2014-05-27 08:16:29 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2014-05-27 13:08:37 UTC Comment hidden (obsolete)
Comment 3 Galen Charlton 2014-05-27 18:05:59 UTC
Created attachment 28497 [details] [review]
Bug 12315: fix sending of duplicate advanced notices (and sending advanced notices to wrong patron)

Bug 10833 introduced a variable loop but does not reset it every
iteration.

So the first patron receives correct letters, but the following ones
received all the previous ones as well as their own notices

Test plan:
0/ Delete the content of the message_queue table.
1/ Define advanced notices sent 2 days in advance for 2 patrons.
2/ Check 1 item out for each one and specify a due date today + 2 days.
3/ Launch the advance_notices.pl script.
4/ Before this patch, you got 3 notices. Now, you get 2 notices, 1 for
   each patron.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work well, no errors.

Tested following test plan, printing on screen or saving into db,
3 messages before, 2 after (advance_notices.pl -v -n -m 2 -c)

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Comment 4 Tomás Cohen Arazi (tcohen) 2014-05-30 18:57:20 UTC
Pushed to master.

Thanks Jonathan!
Comment 5 Galen Charlton 2014-05-30 19:46:27 UTC
Pushed to 3.16.x.
Comment 6 Olli-Antti Kivilahti 2014-06-10 07:07:24 UTC
Thanks for this great fix!
It saved us a lot of trouble,

too bad this didn't extend to the digest subsystem as well.
I provided a followup as a separate Bug 12396.

Take care!
Comment 7 Fridolin Somers 2014-12-29 17:51:18 UTC
Bug 10833 is only since 3.16 so this patch is not needed for 3.14 and below.
I set as fixed