[Bug 42645] New: ModSuggestion: FallbackToSMSIfNoEmail ignores EmailFieldPrimary/EmailFieldPrecedence
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Bug ID: 42645 Summary: ModSuggestion: FallbackToSMSIfNoEmail ignores EmailFieldPrimary/EmailFieldPrecedence Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org The transport-selection logic in C4/Suggestions.pm (ModSuggestion, ~line 253) checks !$patron->email when deciding whether to fall back to SMS for purchase-suggestion status-change notices (ACCEPTED, AVAILABLE, REJECTED, ORDERED, CHECKED). $patron->email returns the raw borrowers.email column value and does not consult the EmailFieldPrimary or EmailFieldPrecedence system preferences. The correct method is $patron->notice_email_address, which applies those preferences. A patron who has only emailpro or B_email populated (with borrowers.email empty) will incorrectly receive their status-change notice via SMS even when they have a valid, reachable email address, because the FallbackToSMSIfNoEmail check sees an empty borrowers.email and treats the patron as having no email at all. See also: Bug 39984 Test plan: 1. Enable FallbackToSMSIfNoEmail. 2. Set EmailFieldPrimary to emailpro (or EmailFieldPrecedence to emailpro|email|B_email). 3. Create a patron with emailpro populated, borrowers.email empty, and smsalertnumber set. 4. Submit a purchase suggestion as that patron and accept it. 5. Check the message_queue table. 6. Without patch: the ACCEPTED notice is queued with message_transport_type = 'sms'. 7. Apply patch: the ACCEPTED notice is queued with message_transport_type = 'email' and sent to the emailpro address. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hdunne-howrie@westminster.g | |ov.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Sponsorship status|--- |Sponsored Status|NEW |Needs Signoff Comma delimited| |OpenFifth list of Sponsors| |<https://openfifth.co.uk/> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 199298 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199298&action=edit Bug 42645: Use notice_email_address in ModSuggestion SMS fallback check The FallbackToSMSIfNoEmail transport selection in ModSuggestion() was checking $patron->email (the raw borrowers.email column) rather than $patron->notice_email_address, which respects the EmailFieldPrimary and EmailFieldPrecedence system preferences. Patrons with only emailpro or B_email set were incorrectly receiving suggestion status-change notices via SMS even when a valid email address was available. Sponsored-by: OpenFifth <https://openfifth.co.uk/> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 199299 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199299&action=edit Bug 42645: Add tests for FallbackToSMSIfNoEmail with alternate email fields Verify that the SMS fallback in ModSuggestion() respects EmailFieldPrimary and EmailFieldPrecedence: a patron with smsalertnumber and an emailpro address (but no borrowers.email) must receive the notice by email, not SMS. Sponsored-by: OpenFifth <https://openfifth.co.uk/> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42646 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42646 [Bug 42646] ModSuggestion: SMS status-change notices always contain email template content -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199298|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199299|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 199327 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199327&action=edit Bug 42645: Use notice_email_address in ModSuggestion SMS fallback check The FallbackToSMSIfNoEmail transport selection in ModSuggestion() was checking $patron->email (the raw borrowers.email column) rather than $patron->notice_email_address, which respects the EmailFieldPrimary and EmailFieldPrecedence system preferences. Patrons with only emailpro or B_email set were incorrectly receiving suggestion status-change notices via SMS even when a valid email address was available. Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 199328 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199328&action=edit Bug 42645: Add tests for FallbackToSMSIfNoEmail with alternate email fields Verify that the SMS fallback in ModSuggestion() respects EmailFieldPrimary and EmailFieldPrecedence: a patron with smsalertnumber and an emailpro address (but no borrowers.email) must receive the notice by email, not SMS. Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #5 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. Set SMSSendDriver system preference to "Email" (so can add an SMS number) 2. emailpro = secondary email 3. Set up an SMTP server (Administration > Additional parameters > SMTP servers), so can process the message queue and see that the email message goes to the secondary email address.[1] 4. I used Mary Burton as the patron account: - left primary email field empty - added a secondary email address and SMS number - edited username and password so can log in and add a purchase suggestion 5. Check the message queue in the database: - koha-mysql kohadev - select * from message_queue\G 6. Metadata from the message queue when processed (to address = secondary email address): metadata: letter_code: ACCEPTED message_transport_type: email status: sent time_queued: 2026-05-19 20:59:52 updated_on: 2026-05-19 21:00:38 to_address: david@davidnind.com cc_address: from_address: root@localhost reply_address: NULL content_type: NULL failure_code: 7. Tests pass: t/db_dependent/Suggestions.t [1] To test sending emails using a Google account ================================================= To test sending emails using a Google account: 1. Set up an App password for your Google Account 2. Configure a new 'SMTP Server' under 'Administration > SMTP servers' using the following settings, where `User name` = your Google email address and `Password` = your APP password, not your Google account password 3. Set this server as default Host: smtp.gmail.com Port: 587 Timeout: 5 SSL: STARTTLS User name: GOOGLEACCOUNTUSER Password: GOOGLEAPPPASSWORD -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- David, as ever.. you are awesome! Thankyou for the super quick testing :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |lisette@bywatersolutions.co |y.org |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #7 from Lisette Scheer <lisette@bywatersolutions.com> --- Works great! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199327|0 |1 is obsolete| | Attachment #199328|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 --- Comment #8 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 201101 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201101&action=edit Bug 42645: Use notice_email_address in ModSuggestion SMS fallback check The FallbackToSMSIfNoEmail transport selection in ModSuggestion() was checking $patron->email (the raw borrowers.email column) rather than $patron->notice_email_address, which respects the EmailFieldPrimary and EmailFieldPrecedence system preferences. Patrons with only emailpro or B_email set were incorrectly receiving suggestion status-change notices via SMS even when a valid email address was available. Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 --- Comment #9 from Lisette Scheer <lisette@bywatersolutions.com> --- Created attachment 201102 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201102&action=edit Bug 42645: Add tests for FallbackToSMSIfNoEmail with alternate email fields Verify that the SMS fallback in ModSuggestion() respects EmailFieldPrimary and EmailFieldPrecedence: a patron with smsalertnumber and an emailpro address (but no borrowers.email) must receive the notice by email, not SMS. Sponsored-by: OpenFifth <https://openfifth.co.uk/> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 --- Comment #10 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42645 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Pushed to main |Pushed to stable Version(s)|26.11.00 |26.11.00,26.05.02 released in| | --- Comment #11 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Pushed to 26.05.x for upcoming 26.05.02 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org