Bug 27860: Fix self-registration if messages with incorrect email are inqueued
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 5 Mar 2021 09:04:14 +0000 (10:04 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 16 Mar 2021 11:04:05 +0000 (12:04 +0100)
commit87eaaf302c5f228598bdbb055bd6bcdccf9883d9
tree75a58eb687120ea0b58eecd58b52c5a93c88fb58
parent2bad23f1c1dbd74b81fefb1939b2bcefd914b3d0
Bug 27860: Fix self-registration if messages with incorrect email are inqueued

If the pref KohaAdminEmailAddress was not set correctly (invalid email)
and has been used to generate message, the message_queue table can contain
some messages that are not sent (pending) and will be processed each
time a new self-reg is done.
The PatronSelfRegistrationVerifyByEmail feature must send only the
notice we just generated, not the whole pending queue.

Test plan:
1. Do not apply the patches
2. Set KohaAdminEmailAddress to an invalid email (root@localhost for
instance)
3. Turn on PatronSelfRegistrationVerifyByEmail
4. Self-reg a patron
5. Boom (that must be fixed on a separate bug report)
6. Set KohaAdminEmailAddress to a valid email (root@example.org)
7. Self-reg a patron
8. Still Boom! (because it's processing the first invalid email)
9. Apply the patches, restart_all
10. Self-reg a patron
=> The email is sent!
Notice the change in DB, the first email is still there with status
"pending" and second email is sent!

QA: at step 10. TODO first email must be 'failed' (highlight in tests)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
opac/opac-memberentry.pl