If the system preference AutoEmailPrimaryAddress is set to alternate or work this e-mail addresses should be used to send out all emails. This works for most notices, but sadly not for CHECKIN, CHECKOUT and RENEWAL notices. http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=C4/Message.pm;hb=7d35bdf58a0bcebab20df47b50b249cafe12ddb6#l178 sub _to_address is hardcoded to use the first e-mail field that is set in the patron record. It should follow the AutoEmailPrimaryAddress setting instead. Bug 12802 fixed it, but it's a new feature. Woudl still be good to fix this especially for stable releases.
Still valid, especially since bug 12802 is currently sitting in FQA.
*** Bug 20228 has been marked as a duplicate of this bug. ***
Created attachment 148053 [details] [review] Bug 18398: Update C4::Message enqueue to use $patron->notice_email_address This patch updates the enque method in C4::Message to expect a Koha::Patron object in the parameters and then uses that patron object to select the correct email address for notices as defined by AutoEmailPrimaryAddress.
This affects the notices Katrin mentions and also Recalls notices as that module has since been pushed and also uses the C4::Message module.
Behold, the monstruous test plan! *thunder crackles* To test CHECKIN/CHECKOUT/RENEWAL with AutoEmailPrimaryAddress 1. Set RenewalSendNotice to 'Send' 2. Change email addresses of a patron (I used Edna Acosta) - In the 'Primary email' field, enter something like primary@... - In the 'Secondary email' field, enter something like secondary@... - In the 'Email' field of the 'Alternate address' section, enter something like alternate@... 3. Change messaging preferences of the same patron - Item check-in = email - Item checkout and renewal = email 4. Set AutoEmailPrimaryAddress to primary email address (home) 5. Check out an item to the patron 6. Check the to_address in the message_queue table for CHECKOUT, it should be primary@... select to_address, letter_code, time_queued from message_queue where date(time_queued) = curdate(); 7. Renew the checkout 8. Check the to_address in the message_queue table for RENEWAL, it should be primary@... select to_address, letter_code, time_queued from message_queue where date(time_queued) = curdate(); 9. Check in the item 10. Check the to_address in the message_queue table for CHECKIN, it should be primary@... select to_address, letter_code, time_queued from message_queue where date(time_queued) = curdate(); 11. Delete the messages from the message_queue. delete from message_queue where to_address like 'primary%'; 12. Change AutoEmailPrimaryAddress to secondary email address (work) 13. Redo steps 5 to 10. The address in the message_queue table should now be secondary@... 14. Delete the messages from the message_queue. delete from message_queue where to_address like 'secondary%'; 15. Change AutoEmailPrimaryAddress to alternate email address (alternate) 16. Redo steps 5 to 10. The address in the message_queue table should now be alternate@... 17. Delete the messages from the message_queue. delete from message_queue where to_address like 'alternate%'; 18. Change AutoEmailPrimaryAddress to cardnumber as 19. Redo steps 5 to 10. The address in the message_queue table should now be the patron's cardnumber 20. Delete the messages from the message_queue. delete from message_queue where to_address = '23529001000463'; 21. Change AutoEmailPrimaryAddress to first valid 22. Redo steps 5 to 10. The address in the message_queue table should now be primary@... 23. Delete the messages from the message_queue. delete from message_queue where to_address like 'primary%'; 24. Remove the patron's primary email address 25. Redo steps 5 to 10. The address in the message_queue table should now be secondary@... 26. Delete the messages from the message_queue. delete from message_queue where to_address like 'secondary%'; 27. Remove the patron's secondary email address 28. Redo steps 5 to 10. The address in the message_queue table should now be alternate@... 29. Delete the messages from the message_queue. delete from message_queue where to_address like 'alternate%'; 30. Remove the patron's alternate email address 31. Redo steps 5 to 10. The address in the message_queue table should now be empty To test RECALLS with AutoEmailPrimaryAddress 0. Set up recalls (see bug 19532) 1. Change email addresses of a patron (I used Edna Acosta) - In the 'Primary email' field, enter something like primary@... - In the 'Secondary email' field, enter something like secondary@... - In the 'Email' field of the 'Alternate address' section, enter something like alternate@... 2. Set AutoEmailPrimaryAddress to primary email address (home) 3. Place a recall from the patron's OPAC account 4. Check in the recalled item and confirm recall 5. Check the to_address in the message_queue table for CHECKIN, it should be primary@... select to_address, letter_code, time_queued from message_queue where date(time_queued) = curdate(); 6. Delete the messages from the message_queue. delete from message_queue where to_address like 'primary%'; 7. Change AutoEmailPrimaryAddress to secondary email address (work) 8. From the patron's recalls in the staff interface, click Actions > Revert waiting 9. Redo step 4 and 5. The address in the message_queue table should now be secondary@... 10. Delete the messages from the message_queue. delete from message_queue where to_address like 'secondary%'; 11. Change AutoEmailPrimaryAddress to alternate email address (alternate) 12. Redo step 4 and 5. The address in the message_queue table should now be alternate@... 13. Delete the messages from the message_queue. delete from message_queue where to_address like 'alternate%'; 14. Change AutoEmailPrimaryAddress to cardnumber as 15. Redo step 4 and 5. The address in the message_queue table should now be the patron's cardnumber 16. Delete the messages from the message_queue. delete from message_queue where to_address = '23529001000463'; 17. Change AutoEmailPrimaryAddress to first valid 18. Redo step 4 and 5. The address in the message_queue table should now be primary@... 19. Delete the messages from the message_queue. delete from message_queue where to_address like 'primary%'; 20. Remove the patron's primary email address 21. Redo step 4 and 5. The address in the message_queue table should now be secondary@... 22. Delete the messages from the message_queue. delete from message_queue where to_address like 'secondary%'; 23. Remove the patron's secondary email address 24. Redo steps 4 and 5. The address in the message_queue table should now be alternate@... 25. Delete the messages from the message_queue. delete from message_queue where to_address like 'alternate%'; 26. Remove the patron's alternate email address 27. Redo steps 4 and 5. The address in the message_queue table should now be empty
Created attachment 148130 [details] [review] Bug 18398: Update C4::Message enqueue to use $patron->notice_email_address This patch updates the enque method in C4::Message to expect a Koha::Patron object in the parameters and then uses that patron object to select the correct email address for notices as defined by AutoEmailPrimaryAddress. Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Wow, nice test plan Caroline.. Thankyou for being so vigorous and thorough :)
The POD needs an update for the changed parameter Could you provide unit tests?
Created attachment 148816 [details] [review] Bug 18398: Update C4::Message enqueue to use $patron->notice_email_address This patch updates the enque method in C4::Message to expect a Koha::Patron object in the parameters and then uses that patron object to select the correct email address for notices as defined by AutoEmailPrimaryAddress. Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Created attachment 148817 [details] [review] Bug 18398: (follow-up) Update POD & Unit tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Thanks Nick :).. POD now updated and Unit tests added
Created attachment 148838 [details] [review] Bug 18398: Update C4::Message enqueue to use $patron->notice_email_address This patch updates the enque method in C4::Message to expect a Koha::Patron object in the parameters and then uses that patron object to select the correct email address for notices as defined by AutoEmailPrimaryAddress. Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 148839 [details] [review] Bug 18398: (follow-up) Update POD & Unit tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed to master for 23.05. Nice work everyone, thanks!
Backport to 22.11 would probably be good for this one
Nice work, thanks everyone! Pushed to 22.11.x for the next release.
Backported to 22.05.x for upcoming 22.05.13
doesn't apply to 21.11