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>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2026-05-19 16:40:34 +01:00 committed by Lucas Gass
parent 59b9b74fc3
commit 1d9237f6b6
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 1 additions and 1 deletions

View File

@ -108,7 +108,7 @@ sub ModSuggestion {
my $transport =
( C4::Context->preference("FallbackToSMSIfNoEmail") )
&& ( $patron->smsalertnumber )
&& ( !$patron->email ) ? 'sms' : 'email';
&& ( !$patron->notice_email_address ) ? 'sms' : 'email';
if (
my $letter = C4::Letters::GetPreparedLetter(