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...
Created attachment 28481 [details] [review] Bug 12315: Advanced notices are duplicated and not sent to the right patron 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. 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.
Created attachment 28489 [details] [review] [SIGNED-OFF] Bug 12315: Advanced notices are duplicated and not sent to the right patron 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. 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)
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>
Pushed to master. Thanks Jonathan!
Pushed to 3.16.x.
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!
Bug 10833 is only since 3.16 so this patch is not needed for 3.14 and below. I set as fixed